struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Weber <>
Subject [OT] "Enter" key listener for form submittal
Date Wed, 01 Sep 2004 13:52:53 GMT
I found this JavaScript, which is supposed to listen for the "Enter" key 
on any browser (and submit the form on keypress). However, it doesn't 
seem to be working in IE:

<script language="JavaScript">
  if (document.layers) document.captureEvents(Event.KEYDOWN);
  document.onkeydown = 
    function (evt) {
      var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : evt.keyCode;
      if (keyCode == 13) {

Does anyone have an "Enter" key listener that has been shown to work in 
all browsers, or know what is wrong with this one?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message