470,815 Members | 1,314 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Assining key to button script

P K
Hi,
I'd like to be able to use the arrow keys to trigger my navigation
buttons. How do I specify that a right arrow key (->) is to activate the
link of my right arrow button, and so forth?
Thanks
--Paul
Jul 23 '05 #1
1 1475
P K wrote:
I'd like to be able to use the arrow keys to trigger my navigation
buttons. How do I specify that a right arrow key (->) is to activate the
link of my right arrow button, and so forth?


I 'm afraid that not every navigation button can be replaced by a keystroke.

Code undernetah could be an approach for Internet Explorer users, dealing with:
arrow left = go to previous page
arrow right = go to next page
arrow up= refresh page

Bart

<html>
<head>
<script language="JavaScript">
function myHandle()
{
// uncomment this to see the keycode of current key
// alert (event.keyCode);

if (event.keyCode=="37") { history.go(-1); }
if (event.keyCode=="38") { location.reload(); }
if (event.keyCode=="39") { history.go(+1); }
}
</script>
</head>
<body onLoad="self.focus(); document.body.onkeydown = myHandle;">
your webpage
</body>
</html>
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by TrvlOrm | last post: by
11 posts views Thread by Dot net work | last post: by
7 posts views Thread by Miguel Dias Moura | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.