Connecting Tech Pros Worldwide Forums | Help | Site Map

Assining key to button script

P K
Guest
 
Posts: n/a
#1: Jul 23 '05
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

Bart Van der Donck
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Assining key to button script


P K wrote:
[color=blue]
> 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?[/color]

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>
Closed Thread