SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: javascript

  1. #1
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript

    how to validate in email field

  2. #2
    SitePoint Addict ALL's Avatar
    Join Date
    Oct 2005
    Location
    South Dakota
    Posts
    215
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    try something like this:
    HTML Code:
    <!-- TWO STEPS TO INSTALL EMAIL VALIDATION - BASIC:
    
      1.  Copy the coding into the HEAD of your HTML document
      2.  Add the last code into the BODY of your HTML document  -->
    
    <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
    
    <HEAD>
    
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    
    <!-- Begin
    function checkEmail(myForm) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emailAddr.value)){
    return (true)
    }
    alert("Invalid E-mail Address! Please re-enter.")
    return (false)
    }
    //  End -->
    </script>
    
    </HEAD>
    
    <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
    
    <BODY>
    
    
    <form onSubmit="return checkEmail(this)">
    E-mail Address:<br>
    <input type="text" name="emailAddr">
    <p>
    <input type="submit" value="Submit">
    <input type="reset" value="Reset">
    </form>
    
    
    <p><center>
    <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>
    
    <!-- Script Size:  1.07 KB -->
    Taken from: http://javascript.internet.com/forms...n---basic.html
    Did I help you?
    You can repay me, support one of my projects (no money needed):
    JavaScript Wiki, Another Web Forum, Paranormal Site


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •