hi......, i have problem in javascript email validation, I wrote code something like,
//emp.php
<form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2" >
<table>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Desired Email-ID:</td>
<td><input type="text" name="emp_email" value="" size="32" onsubmit="checkMail()";/></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Insert record" onclick="checkMail();"/></td>
</tr>
</table>
</form>
//java scrit code for checkMail()
<script language="javascript">
function checkMail() {
var email=document.getElementById('emp_email').value;
var mail = email.value;
var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}(com|ca|net|org|fr|us|qc.ca|gouv.qc.ca)$', 'i');
if(!reg.test(mail) || mail == "")
{
alert("Your email address isn't valid!");
return false;
}
else {
alert("Email address is okay, let's send the form!");
}
}
</script>
Plz help me thanks in advance