title: Javascript : Enter Key Press
body: <p>Good Morning...</p>
  
  <p>I am using java script in each page to trigger the <kbd>Enter</kbd> key press Event inside the textbox.
  It is working fine. Now i want to place the code in the <code>.js</code> file for global access. </p>
  
  <pre><code> function EnterKeyPress(id,e) {
         // look for window.event in case event isn't passed in
         if (window.event) { e = window.event; }
         if (e.keyCode == 13 || e.keyCode == 121) {
  
             window.document.getElementById('&lt;%= ibtnSubmit.ClientID %&gt;').click();
         } 
     }
  </code></pre>
  
  <p>I dont want to hard code the control id. Can anybody help me please..</p>