Input.onkeydown = function(){ if(window.event) { var Key = window.event.keyCode; }; if(event.which) { var Key = event.which; }; if(Key == 13) { alert('enter'); };};
The problem lies with the event.which bit. "event is not defined". I know how to do it regularly, but I am trying to do it unobtrusively. Thank you.
I think you trying to achieve something like this:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Untitled Document</title></head><body><script type="text/javascript">function keypressed(e){e = e? e : window.event;var Key = e.keyCode? e.keyCode : e.which? e.which : null;if (Key == 13){alert("Enter button Pressed - Press t