Posted By

hotdiggity on 04/30/09


Tagged

forms


Versions (?)

Stop A Form Submitting On Return


 / Published in: JavaScript
 

Works in IE not Firefox/Mozilla.

  1. <SCRIPT LANGUAGE="JavaScript">
  2.  
  3. <!-- Begin
  4. function onKeyPress () {
  5. var keycode;
  6. if (window.event) keycode = window.event.keyCode;
  7. else if (e) keycode = e.which;
  8. else return true;
  9. if (keycode == 13) {
  10. alert("Please Click ONCE on the Submit button to send this");
  11. return false
  12. }
  13. return true
  14. }
  15. document.onkeypress = onKeyPress;
  16. // End -->
  17. </script>

Report this snippet  

You need to login to post a comment.