PDA

View Full Version : Keyboard Navigation!!


ajith_rock
04-03-2007, 09:50 AM
Hi!!,

We have developed a site, which needs to be working completely using the 5 keys, UP, DOWN, RIGHT, LEFT AND ENTER of the keyboard!!... Can anyone help me??...

REAAAAAAAAAAAAALLL DESPERATE AND IN NEED OF HELP!!!

THANX A LOT!

CHEERS,

AJITH

coothead
04-04-2007, 05:28 PM
Hi there ajith_rock,

does this help...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>left, up, right, down and enter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">

function keyNumber(ev) {

nmbr=ev.which?ev.keyCode:ev.which;

switch(nmbr) {
case 37:
alert('this is the left key');
break;

case 38:
alert('this is the up key');
break;

case 39:
alert('this is the right key');
break;

case 40:
alert('this is the down key');
break;

case 13:
alert('this is the enter key');
break;
}
}

</script>

</head>
<body onkeydown="keyNumber(event)">

<div></div>

</body>
</html>

Just replace the alerts with your required code. ;)

coothead

ajith_rock
04-04-2007, 07:12 PM
Hey coothead!,

A million thanx for That!!... Will try extrapolating from it and get back to you!!... Keep rocking and helping!!!... :thumbsup:

Cheers,

Ajith

P.S. Thanx once again!!

coothead
04-04-2007, 07:20 PM
No problem, you're very welcome. ;)