This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Disable enter key for selected submit buttons within a form

By: a guest on Mar 22nd, 2012  |  syntax: HTML  |  size: 0.51 KB  |  views: 44  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <html>
  2.     <head>
  3.         <script type='text/javascript'>
  4. function keyPressed(e)
  5. {
  6.      var key;      
  7.      if(window.event)
  8.           key = window.event.keyCode; //IE
  9.      else
  10.           key = e.which; //firefox      
  11.  
  12.      return (key != 13);
  13.  }
  14.         </script>
  15.     </head>
  16.     <body>
  17.         <form action="1">
  18.             <input type="text" />
  19.         </form>
  20.         <form action="2">
  21.             <input type="text" onKeyPress="return keyPressed(event)"/>
  22.         </form>
  23.     </body>
  24. </html>
clone this paste RAW Paste Data