Move over the table rows using the up and down arrows using the javascript

i had a dynamically generated html table in jsp .

i need to move over the rows up and down .

when the up and down arrow keys are pressed Highlight the row and after moving when i press the enter key other required page is to be displayed .

please help me as soon as possible what events are to be used for the arrow keys and Highlight the row

[367 byte] By [sandeep.mandrumakaa] at [2007-11-27 2:47:46]
# 1
You can have text fiels inside ur td and give eventFunction for that..
mshanua at 2007-7-12 3:17:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

i got the code for it

if (navigator.appName == "Microsoft Internet Explorer") {

document.onkeydown = processKeys;

} else {

document.onkeypress = processKeys;

}

function processKeys(e) {

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

switch (keyID){

// Key up.

case 38:

if (parseInt(currentRow) == parseInt(0)) {

// reached the top of the table; do nothing.

return true;

} else {

// move one row up.

currentRow = parseInt(currentRow - 1);

setCurrentRow (currentRow, currentRow + 1);

return false;

}

break;

// Key down.

case 40:

if (currentRow == (numRows - 1)) {

return true;

} else {

currentRow++;

setCurrentRow (currentRow, (currentRow - 1));

if (currentRow > VISIBLE_ROWS) {

return true;

} else {

return false;

}

}

break;

// enter key

case 13:

var curRowId = boardMemberListTable.rows[currentRow].id;

return false;

break;

}

}

//onclick

function selectRow(row) {

inQuad3Edit = false;

searching = false;

var eleTableRows = boardMemberListTable.getElementsByTagName("tr");

for (var i = 0; i < eleTableRows.length; i++) {

if (eleTableRows.id != row.id){

eleTableRows.className = "board-row-normal";

} else {

currentRow = i;

}

}

row.className = "board-row-sel";

}

sandeep.mandrumakaa at 2007-7-12 3:17:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...