Stop A Form Submitting On Return


/ Published in: JavaScript
Save to your folder(s)

Works in IE not Firefox/Mozilla.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.