title: element onkeydown keycode javascript
body: <p>I am using this code snippet to add KeyDown event handler to any element in the html form</p>
  
  <pre><code>for(var i=0;i&lt;ele.length;i++)
  {
      ele[i].onkeydown = function()
      {
              alert('onkeydown');
      } 
  }
  </code></pre>
  
  <p>How can I know which key has been pressed on keydown event? I try this</p>
  
  <pre><code>for(var i=0;i&lt;ele.length;i++)
  {
      ele[i].onkeydown = function(e)
      {
             alert(e.KeyCode);
      } 
  }
  </code></pre>
  
  <p>but it is not working, why?
  Thanks a lot</p>