Forum Moderators: open

Message Too Old, No Replies

Selecting using up/down keys

Need to select from 10 tables and...

         

multiz

6:29 pm on Mar 1, 2007 (gmt 0)

10+ Year Member



So far I have:

<script type="text/javascript">

document.onkeydown = KeyCheck;
var i=1;

function KeyCheck(e)
{

var KeyID = (window.event)? event.keyCode : e.keyCode;

switch(KeyID)

{
case 38: // UP

i--;

if(i<1)
i=1;

break;

case 40: // DOWN

i++;

if(i>10)
i=10;

break;

}

}
</script>

If anyone can help with this, I'd very much appreciate it. I want to be able to allow the user to select a link from 1-10 (each in a table -- labeled with id 1-10). When the user uses the up/down arrows and they've gone down to the 5th table, I want that table's background color changed and if they press enter it will go to that URL (link) in the table. Each table will have a different link.

PS: This idea has some similarities to snap.com's search engine, but I want use all JavaScript and HTML. If you want to further explain, I'd be glad to.

Thank you for taking a look,
Michael

multiz

8:09 pm on Mar 1, 2007 (gmt 0)

10+ Year Member



I got it to work. Thanks though.

Message to moderator: You can delete this thread id you'd like. Sorry for the inconvienence.