This is probably old news to lots of you but thought I would share anyway

I ran across this today. I had a page with multiple forms on it so when the
user accidentally hit return it has unexpected results. This also works to
prevent return from accidentally submitting a form. It disables the return
key for input type text fields ( HTML of course)

<script type="text/javascript">

function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement
: null); 
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
} 

document.onkeypress = stopRKey;

</script>

This just goes at the top of you page.

I got it from here

http://www.webcheatsheet.com/javascript/disable_enter_key.php

-- 
Dan Stein
FileMaker 7 Certified Developer
Digital Software Solutions
799 Evergreen Circle
Telford PA 18969
Land: 215-799-0192
Cell: 610-256-2843
Fax 215-799-0192 ( Call 1st)
FMP, WiTango, EDI,SQL 2000, MySQL, CWP
[EMAIL PROTECTED]
www.dss-db.com 

"I destroy my enemies when I make them my friends."   

Abraham Lincoln




________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to