Hans wrote:
[color=blue]
> <textarea onkeypress="captureKeys();"....
>
> but I cannot get a reference to the current event so i can ask for the
> keyCode. In IE I can check the event.keyCode inside my function captureKeys
> but this is not possible in NN6+.[/color]
Simply use
<textarea onkeypress="return captureKeys(event);"
and then
function captureKeys (evt) {
var keyCode = evt.keyCode ? evt.keyCode :
evt.charCode ? evt.charCode : evt.which;
if (keyCode == ...) {
// cancel key:
if (evt.preventDefault) {
evt.preventDefault();
}
return false;
}
return true;
}
--
Martin Honnen
http://JavaScript.FAQTs.com/