From an input text I need to call a function to capture the onkeydown event and I need to pass a parameter to that event, for example:
<input type="text" onkeydown="TextOnKeyDown('myPrefix');" />...
Then in that function I need to know what key was pressed. I use
function TextOnKeyDown(prefix) {
var key = event.keyCode;
...
}
This works like a charm in IE, but not in Firefox. I've read that for firefox you have to pass an argument to the handler and then use it to get the key, something similar to:
<input type="text" onkeydown="detectKey(event)"/>
...
function detectKey(e){
var key = (document.all) ? e.keyCode : e.which;
...
}
But I cannot get to pass my parameter and the needed event parameter for firefox. Any suggestions?