title: Login validation using JavaScript
body: <p>Asp login using JavaScript </p>
  
  <p>It is not working and I don't know why? <code>function check()</code></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script&gt;
              function check() {
                  var jname, jpass, jpre_pass, jmail;
                  jname = document.getElementById("name").value;
                  jpass = document.getElementById("pass").value;
                  jpre_pass = document.getElementById("pre_pass").value;
                  jmail = document.getElementById("mail").value;
                  var emailExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([com\co\.\in])+$/; 
                  if (isNan(jname)) {
                      document.getElementById("cname").innerHTML = "enter the name first";
                      document.getElementById("lcheck").innerHTML = "false";
                  }
                  if (isNan(jpass)) {
                      document.getElementById("cpas").innerHTML = "enter the password ";
                      document.getElementById("lcheck").innerHTML = "false";
                  }
                  if (isNan(jpre_pass)) {
                      document.getElementById("cpre_pass").innerHTML = "enter the  pre_pass";
                      document.getElementById("lcheck").innerHTML = "false";
                  } else if (jpre_pass != jpass) {
                      document.getElementById("cpre_pass").innerHTML = "passwords not matches";
                      document.getElementById("lcheck").innerHTML = "false";
                  }
                  if (isNan(jmail)) {
                      document.getElementById("cmail").innerHTML = "enter the mail";
                      document.getElementById("lcheck").innerHTML = "false";
                  }else if(jmail.match(emailExp))
                  {
                      document.getElementById("cmail").innerHTML = "invalid mail";
                      document.getElementById("lcheck").innerHTML = "false";
                  }
              }
          &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt;
              &lt;asp:TextBox ID="name" runat="server"&gt;&lt;/asp:TextBox&gt;
              &lt;p id="cname"&gt;&lt;/p&gt;
              &lt;asp:TextBox ID="pass" runat="server"&gt;&lt;/asp:TextBox&gt;
              &lt;p id="cpass"&gt;&lt;/p&gt;
              &lt;asp:TextBox ID="pre_pass" runat="server"&gt;&lt;/asp:TextBox&gt;
              &lt;p id="cpre_pass"&gt;&lt;/p&gt;
              &lt;asp:TextBox ID="mail" runat="server"&gt;&lt;/asp:TextBox&gt;
              &lt;p id="cmail"&gt;&lt;/p&gt;
              &lt;asp:Label ID="lcheck" runat="server" Text=""&gt;&lt;/asp:Label&gt;
              &lt;asp:Button ID="btn" runat="server" Text="submit" OnClientClick="check()"/&gt;
              
          &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>