Javascript function: something is not working
<p>I have a Javascript function in my application for validating a form and I am calling it on a button click. But the script is not working.</p>

<p><strong>SCRIPT</strong>:</p>

<pre><code>function payment() {
  alert("hi");
  var theuser = document.getElementById("&lt;%=txtcardname.ClientID%&gt;").value;
  var thecardno = document.getElementById("&lt;%=txtcreditdet.ClientID%&gt;").value;
  var thecvv = document.getElementById("&lt;%=txtcvv.ClientID%&gt;").value;
  var matchname = theuser.match(userRegex);
  var divcontent = document.getElementById("&lt;%=errorcontent.ClientID%&gt;");
  var msglbl = document.getElementById("&lt;%=lblerror.ClientID%&gt;");
  var ermsg = "";
  /*username validation*/
  if (matchname == null) {
    ermsg += "&lt;li class='logli'&gt;Username is Empty or Invalid.&lt;/li&gt;";
  }
  /*Mobile validation*/
  if (themobile.length != 10) {
    ermsg += "&lt;li class='logli'&gt;Enter Your CardNumber Correctly.&lt;/li&gt;";
  }
  /*Email validation*/
  if (thecvv.length!=3) {
    ermsg += "&lt;li class='logli'&gt;Enter Ur Cvv Correctly.&lt;/li&gt;";
  }
  if (ermsg != "") {
    divcontent.style.display = "block";
    divcontent.style.background-colour="Aqua";
    divcontent.style.border = "1px solid #ff0000";
    divcontent.style.width = "100%";
    divcontent.style.margin = "0px 0 10px 15px";
    msglbl.style.display = "block";
    msglbl.style.margin = "0 0 15px 15px";
    msglbl.innerHTML = "Please correct the below errors" + "&lt;ul&gt;" + ermsg + "&lt;/ul&gt;";
    return false;
  }
  return true;
}
</code></pre>

<p><strong>ASPX</strong>:</p>

<pre><code>&lt;asp:Button ID="btnpay" runat="server" Text="PAY" CssClass="btnpaystyle" OnClientClick="if(!payment())return false;"/&gt;
</code></pre>

<p><strong>NOTE</strong>: I am calling the function <code>payment()</code> in the clientclick event of a button.</p>
