posted 17 years ago
Thanks! I used onkeyup event, however, i can't seem to pass a variable or an argument to my function. this is what i have:
//where row is the row I want to delete
function checkRow (row, event)
{
if (window.event.button == 2)
{*rightclick code*}
//left click code
else if (window.event.button == 1) {
if( document.captureEvents && event.KEYUP ) {
document.captureEvents( event.KEYUP );
}
document.onkeyuf = doSomething;
}
}
function doSomething (e){
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
alert('Character was ' + character);
}
this works, that is, i'm getting the keycode that i want to, but i want to also pass the row variable that i have from check row so i could do deleteRow (row.rowIndex) in doSomething but when i do this:
document.onkeyuf = doSomething (row);
...
function doSomething (row, e) {
...
alert('Character was ' + character);
}
the keycode i always get is the one for left click and i don't get to press delete anymore after my alert. why is that? how do i solve this? thank you very much!