Hi *.*,
May some of u think whether my stack got empty or what isit??? ha ha ... I know it's a basic but it's important. On last day i c a post on fourms.asp.net asking for an email validation.he got more than 15 answers...Wow what a luck hand full of options. I gone through one by one.And almost all having a similar feature.Complicated !!!.All are touching the finishing lines but that not a good way , i feel so :( . that makes me this post.
Code:
<head runat="server">
<title>Simple javascript Email Validation</title>
<script type="text/javascript">
function evalue(email) {
// debugger;
AtPos = email.indexOf("@")
StopPos = email.lastIndexOf(".")
Message = ""
if (AtPos == -1 || StopPos == -1) {
Message = "Not a valid email address"
}
if (StopPos < AtPos) {
Message = "Not a valid email address"
}
if (StopPos - AtPos == 1) {
Message = "Not a valid email address"
}
if (Message == "")
return true;
else
alert(Message);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="txt" onblur="evalue(this.value)" type="text" />
</div>
</form>
</body>
</html>
Its simple and Sexy na, anyway i can feel it (:P
stay tune...
Have a nice day... 'N happy Coding :)
No comments:
Post a Comment