Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trapping Key Codes

Status
Not open for further replies.

rmagan

Programmer
Jun 3, 2003
35
US
I am trying to trap the enter, down arrow and up arrow keys in my form. I want to set focus to a new field depending on which key is entered. The following code works fine in IE. I need something that works on most browsers (especially Netscape).

<TD align=&quot;center&quot; nowrap>
input type=&quot;text&quot; name=&quot;p_grd_score&quot; size=&quot;5&quot; maxlength=&quot;5&quot; &quot; id=&quot;Cell1&quot; onKeyDown=&quot;switch(event.keyCode) {case 40: document.post_grdbk.Cell2.focus();return false; break;
case 13: document.post_grdbk.Cell3.focus();return false; break;
case 38: document.post_grdbk.Cell4.focus();return false; break;}&quot;
</TD>
 
nope that wont work in NS 4.x versions as their javascript events are primitive...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top