title: Find out which ASP.NET control fired my JavaScript event?
body: <p>I've create a JavaScript function that fires on the OnKeyPress event of a text box. 
  Basically when the function is called a label is displayed telling the user that caps lock is enabled. As you can see from the method below, if the Caps Lock is on 3 labels are displayed but I'd like to use the passed in parameter to find out which textbox fired the event so that I only display one of the caps lock labels. Any ideas</p>
  
  <p>My JScript function is below with one of the calling textboxs below that:</p>
  
  <pre><code>    function capLock(e) {
          kc = e.keyCode ? e.keyCode : e.which;
          sk = e.shiftKey ? e.shiftKey : ((kc == 16) ? true : false);
          if (((kc &gt;= 65 &amp;&amp; kc &lt;= 90) &amp;&amp; !sk) || ((kc &gt;= 97 &amp;&amp; kc &lt;= 122) &amp;&amp; sk))
              document.getElementById('divCurrentPasswordCapsLockStatus').style.visibility = 'visible';
              document.getElementById('divNewPasswordCapsLockStatus').style.visibility = 'visible';
              document.getElementById('divConfirmPasswordCapsLockStatus').style.visibility = 'visible';
          else
              document.getElementById('divCurrentPasswordCapsLockStatus').style.visibility = 'hidden';
              document.getElementById('divNewPasswordCapsLockStatus').style.visibility = 'hidden';
              document.getElementById('divConfirmPasswordCapsLockStatus').style.visibility = 'hidden';
      } 
  
  &lt;asp:TextBox ID="txtCurrentPassword" runat="server" TextMode="Password" CssClass="customtxt" onkeypress="capLock(event)"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>So I'd like to do something like the following with the JScript Function: </p>
  
  <pre><code>if (e.name=="txtCurrentPassword") 
  {
      document.getElementById('divCurrentPasswordCapsLockStatus').style.visibility ='visible';
  }
  else 
  { 
      document.getElementById('divNewPasswordCapsLockStatus').style.visibility = 'hidden';
      document.getElementById('divConfirmPasswordCapsLockStatus').style.visibility = 'hidden';
  }
  </code></pre>
  
  <p>I'm using ASP.Net 4.0</p>
  
  <p>Thanks</p>