WA
08-03-2002, 11:48 PM
Does anyone know if it's possible to return false on a event handler that's attached using script in NS6? Somehow for most events, it doesn't seem to work- in other words, the default action is not cancelled. For example, I can't get the below code to disable the onkeypress event in a textbox in NS6:
<form name="test">
<input type="text" name="test2">
</form>
<script>
document.test.test2.onkeypress = function(){return false};
</script>
The code works as expected in IE4+, but it would seem the only way to get it to work in NS6 is to define the event handler as a HTML attribute (<input type="text" onkeypress="return false">). This defeats the purpose of what I'm working on right now.
I've tried a couple of things to get the above to work, though it's starting to look more like a bug/limitation in NS6 (and NS4, for that matter).
Any insight appreciated.
<form name="test">
<input type="text" name="test2">
</form>
<script>
document.test.test2.onkeypress = function(){return false};
</script>
The code works as expected in IE4+, but it would seem the only way to get it to work in NS6 is to define the event handler as a HTML attribute (<input type="text" onkeypress="return false">). This defeats the purpose of what I'm working on right now.
I've tried a couple of things to get the above to work, though it's starting to look more like a bug/limitation in NS6 (and NS4, for that matter).
Any insight appreciated.