<form name="form1">
<table>
</tr>
<tr>
<td>Email Id:</td>
<td><input type="text" name="email" id="email" onblur="semail()"></td>
<td><span id="d3"></span></td>
</tr>
</table>
</form>
<script>
function semail()
{
var email=document.form1.email.value;
var atpos=email.indexOf("@");
var dotpos=email.lastIndexOf(".");
if(email=="")
{
document.getElementById("d3").innerHTML="<span style='color:red;' >Please Enter Email Id</span>";
document.form1.email.focus();
return false;
}
else if(atpos<1 || dotpos<atpos+2|| dotpos+2>=email.length)
{
document.getElementById("d3").innerHTML="<span style='color:red;' > Invalid Email Id</span>";
document.form1.email.focus();
return false;
}
else
{
document.getElementById("d3").innerHTML="<span style='color:green;' >ok</span>";
return true;
}
}
</script>
<table>
</tr>
<tr>
<td>Email Id:</td>
<td><input type="text" name="email" id="email" onblur="semail()"></td>
<td><span id="d3"></span></td>
</tr>
</table>
</form>
<script>
function semail()
{
var email=document.form1.email.value;
var atpos=email.indexOf("@");
var dotpos=email.lastIndexOf(".");
if(email=="")
{
document.getElementById("d3").innerHTML="<span style='color:red;' >Please Enter Email Id</span>";
document.form1.email.focus();
return false;
}
else if(atpos<1 || dotpos<atpos+2|| dotpos+2>=email.length)
{
document.getElementById("d3").innerHTML="<span style='color:red;' > Invalid Email Id</span>";
document.form1.email.focus();
return false;
}
else
{
document.getElementById("d3").innerHTML="<span style='color:green;' >ok</span>";
return true;
}
}
</script>
0 comments:
Post a Comment