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

 <script type="text/javascript">
        function check_email(email_id,err_id){
            emailRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;
            var err_mail='Email addres incorect!';
            if(emailRegExp.test(document.getElementById(email_id).value)){
                alert('true');
                return true;
            }else{
                document.getElementById(err_id).innerHTML=err_mail;
                alert(err_mail);
                return false;
            }
        }
    </script>

        <span id="err_msg" style="color: red;"></span>
    <form id="myForm" name="myForm" action="./register.php" method="post" onsubmit="return check_email('email','err_msg');">
        <input type="text" name="email" id="email"/>
        <input  type="submit" name="send" value="Send" />
    </form>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS