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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trap for "Tab" in both ie and netscape 1

Status
Not open for further replies.

toddOne

Programmer
Jul 20, 2001
41
0
0
US
i was curious if anyone could help me trap for the "TAB" being pressed. on the keyPress event i can trap for when "Return" or "Esc" and others are pressed by using the keyCode value...i just haven't been able to find a keyCode value for the "TAB"....and work for both IE and Netscape.


any suggestions would be great!!!
 
<html>
<HEAD>
<SCRIPT>
function keyCodesHandler(e)
{
var k = 0;

if (document.all)
{
k = window.event.keyCode
}
else
{
k = e.keyCode
}

if (k == 9)// TAB
{
return false;
}
}

document.onkeydown = keyCodesHandler;

</SCRIPT>
</HEAD>

<BODY>
<a href=&quot;&quot;>test</a>
<a href=&quot;&quot;>test</a>
<a href=&quot;&quot;>test</a>

</BODY>
</html> Gary Haran
 
thanks.....this is exactly what i needed!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top