HTML File
<div class="lbl">Email : </div>
<div class="ctrl">
<input type="text" name="mail" id="mail">
<span id ="err_mail"></span>
</div>
Java Script File
function mail_validation(mail)
{
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (mail.value.match(mailformat))
{
document.getElementById("err_mail").innerHTML = "";
return true;
}
else
{
var msg = "please enter valid mail addr. ...";
document.getElementById("err_mail").innerHTML = msg;
mail.focus();
return false;
}
}
No comments:
Post a Comment