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

Tab key 2

Status
Not open for further replies.

soonkhoo

Programmer
Dec 8, 2000
133
MY
Hi.. quick question, how can I press on the Tab key to link me to the next page?

Thanks

Soon
 
hie
i cant get it 2 work for tab key, but here is how 2 capture keypress & knowout what key was pressed (tab keykode=9)
<script>
function tabgo(e){
var key=event.keyCode
if (key==32) alert('space')
}
document.onkeyup=tabgo
</script>
& there u can set whatever action (history.forward() in ur case)
but it looks like i'm goin the wrong way..:cool: regards, vic
 
Hi soonkboo,

this will works in NN6 and IE4 only~

<script language=&quot;JavaScript&quot;>
var IE4 = (document.all);
var NS4 = (document.layers);
var NS6 = (document.getElementById && !document.all)

if (NS4 || NS6) document.captureEvents(Event.KEYDOWN);
document.onkeydown = ShortCut;

function ShortCut(e) {
whichASC = (NS4 || NS6) ? e.which : event.keyCode;
switch (whichASC) {
case 9:
alert(&quot;tab&quot;);
document.location=&quot; default:break;
}
}
</script>

hope this helps, Chiu Chan
WebMaster & Software Engineer
emagine solutions, inc
cchan@emagine-solutions.com
 
yeah, it works with onkeydown, not onkeyup X-) regards, vic
 
thanks people!!!

one more question...

if i have a frameset... do i need to select a frame first before executing the script? or can i avoid that? i just want to be able to press tab when I first enter the frameset.

soon
 
hie
may be u shuld place ur script in the head section of the frameset document & then use smth like parent.ShortCut() ?
just an idea.. regards, vic
 
Hi..

I am using pepperpepsi code for capturing tab key... how do I make sure that when the user presses any other key other than the tab key, it will take them to a different location?

thanks.
Soon
 
hie
switch (whichASC) {
case 9:
alert(&quot;tab&quot;);
document.location=
Code:
&quot;[URL unfurl="true"]http://www.cnn.com&quot;;[/URL]
default:
Code:
document.location=&quot;[URL unfurl="true"]http://www.yahoo.com&quot;;[/URL]
}
Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top