How can I trigger submit button thruough the Enter key in both Netscape and Internet Explorer?
Created May 7, 2012
Jasper Bos This script works both in IE and NS because of the evt.which (IE) and evt.keyCode (NS) enjoy:
<SCRIPT LANGUAGE="JavaScript1.3"> //Enter-listener if (document.layers) document.captureEvents(Event.KEYDOWN); document.onkeydown = function (evt) { var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode; if (keyCode == 13) //13 = the code for pressing ENTER
{ document.form.submit(); } } </SCRIPT>