How can I trigger submit button thruough the Enter key in both Netscape and Internet Explorer?

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">
if (document.layers)
  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>