Advertisement
rahul244698

validation

Mar 8th, 2013
1,315
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function validateForm()
  2. {
  3. var x=document.forms["myForm"]["email"].value;
  4. var atpos=x.indexOf("@");
  5. var dotpos=x.lastIndexOf(".");
  6. if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
  7.   {
  8.   alert("Not a valid e-mail address");
  9.   return false;
  10.   }
  11. }
Advertisement
RAW Paste Data Copied
Advertisement