Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Voloshin Ruslan http://rubyclub.com.ua/

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Check email in html form

// description of your code here

   1  
   2   <script type="text/javascript">
   3          function check_email(email_id,err_id){
   4              emailRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;
   5              var err_mail='Email addres incorect!';
   6              if(emailRegExp.test(document.getElementById(email_id).value)){
   7                  alert('true');
   8                  return true;
   9              }else{
  10                  document.getElementById(err_id).innerHTML=err_mail;
  11                  alert(err_mail);
  12                  return false;
  13              }
  14          }
  15      </script>
  16  
  17          <span id="err_msg" style="color: red;"></span>
  18      <form id="myForm" name="myForm" action="./register.php" method="post" onsubmit="return check_email('email','err_msg');">
  19          <input type="text" name="email" id="email"/>
  20          <input  type="submit" name="send" value="Send" />
  21      </form>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS