title: Email verfication html and javascript
body: <p>below is my code mainly for "Email Validation" but for some reason its not working properly i have no idea why , so do you mind taking a look please. thanks</p>
  
  <p>I guess the main problem is with that line <code>document.getElementById("custEmail").onchange = chkEmail;</code> for some reason <code>chkEmail</code> is a problem...and also the search part <code>myEmail.value.search(+@[a-zA-Z_]+?.[a-zA-</code></p>
  
  <pre><code>    &lt;html  xmlns = "http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;title&gt;Web Assignment 1 :Online shopping form&lt;/title&gt;
  
  
  &lt;script type = "text/javascript"&gt;
  
  
  
        function chkEmail() {
          var myEmail = document.getElementById("custEmail");
  
  
          var pos = myEmail.value.search(+@[a-zA-Z_]+?.[a-zA-Z]{2,6});
  
          if (pos != 0) {
            alert("The email you entered (" + myEmail.value + 
                  ") is not in the correct form. \n" +
                  "The correct form is: " +
                  "whatever@whatever.xxx\n" +
  "Please fix it");
            myEmail.focus();
            myEmail.select();
            return false;
          } else
            return true;
        }
  
  
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt; Please fill in the information below &lt;/h1&gt;
  
  &lt;form action="" 
  &gt;
  &lt;p&gt;
  &lt;h2&gt; Contact Info...&lt;/h2&gt;
  &lt;pre&gt;
       Last  Name     :  &lt;input type="text" name="name2" size="20"&gt;
       Email          :  &lt;input type="email" id = "custEmail" onchange ="chkEmail();" size="30"&gt;
       Mobile number  :  &lt;input type="text" name="mob" size="15"&gt;
      &lt;/pre&gt;
   &lt;input type = "reset"  id = "reset" /&gt;
  &lt;input type = "submit"  id = "submit" /&gt;
    &lt;/p&gt;
  
   &lt;/form&gt;
   &lt;script type = "text/javascript"&gt;
        &lt;!--
  // Set form element object properties to their 
  // corresponding event handler functions
  
          document.getElementById("custEmail").onchange = chkEmail;
        // --&gt;
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>