PDA

View Full Version : مشکل توی اعتبار سنجی در فیلد ایمیل دارم



mohsen_dva
چهارشنبه 14 مهر 1395, 11:54 صبح
سلام خدمت دوستان

بنده ی صفحه تماس با ما دارم
کد جاوا اسکریپت رو تو هدر اینجوری نوشتم:


<script language="javascript">
function CheckEmail()
{
var address = document.feedback.mail.value;
if (address.indexof("@") == -1 || address.length < 6)
{
alert("ایمیل وارد شده صحیح نمی باشد.");
}
else
return true;
}
</script>

بعد فرمم هم به این شکل هست:


<form name="feedback" onsubmit="return CheckEmail()" action="send_contact.php" method="post" >

<div class="contactr1"><input type="text" placeholder="نام و نام خانوادگی (ضروری)" value="نام و نام خانوادگی (ضروری)" onfocus="if (this.value == 'نام و نام خانوادگی (ضروری)') {this.value = '';}" onblur="if
(this.value == '') {this.value = 'نام و نام خانوادگی (ضروری)';}" name="name" id="name" size="22" tabindex="1" aria-required="true" autocomplete="off" tabindex="1"></div>
<div class="contactr2"><input type="text" name="mail" id="mail" placeholder="ایمیل (ضروری)" value="ایمیل (ضروری)" onfocus="if (this.value == 'ایمیل (ضروری)') {this.value = '';}" onblur="if
(this.value == '') {this.value = 'ایمیل (ضروری)';}" size="22" tabindex="2" aria-required="true" autocomplete="off" tabindex="2"></div>
<div class="contactr3"><input type="text" placeholder="تلفن (اختیاری)" value="تلفن (اختیاری)" onfocus="if (this.value == 'تلفن (اختیاری)') {this.value = '';}" onblur="if
(this.value == '') {this.value = 'تلفن (اختیاری)';}" name="city" id="email" size="22" tabindex="3" aria-required="true" autocomplete="off"></div>
<div class="contactr4"><input type="text" placeholder="آدرس سایت (اختیاری)" value="آدرس سایت (اختیاری)" onfocus="if (this.value == 'آدرس سایت (اختیاری)') {this.value = '';}" onblur="if
(this.value == '') {this.value = 'آدرس سایت (اختیاری)';}" name="mobile" id="url" size="22" tabindex="4" autocomplete="off"></div>
</div>

<div class="contactl">
<div class="contactr5"><textarea name="message" placeholder="دیدگاه خود را بنویسید" value="دیدگاه خود را بنویسید" onfocus="if (this.value == 'دیدگاه خود را بنویسید') {this.value = '';}" onblur="if
(this.value == '') {this.value = 'دیدگاه خود را بنویسید';}" id="message" cols="40" rows="11" tabindex="5"></textarea></div>
</div>
</div>
<div class="cleaner"></div>
<div class="contantf">
<input name="submit" type="submit" id="submit" class="Green" tabindex="6" value="ارسال">
<input name="reset" type="reset" id="submit" tabindex="7" class="red" value="ریست فرم">


</div>
</form>

اما این کد کار نمیکنه!!<br><br>میشه کمکم کنید؟:ناراحت: