F
Fred Brown
Hi,
I want to cancel a certain key in JavaScript.
To do so, I catch the event in OnKeyPress and cancel the default:
<head>
....
function f(evt)
{
var evt = (evt) ? evt : ((window.event) ? window.event : "")
...
evt.returnValue = false; // IE
evt.preventDefault(); // dom 2 (also tried without this here)
return false; // netscape
}
....
<body>
....
<TEXTAREA Name=demoTextarea ROWS=10 COLS=50 OnKeyPress="f(event)">
</TEXTAREA>
IE works fine.
Safari will not cancel the key.
I also checked to see if the textArea value already had received the
key before this handler. It had not.
Any ideas?
Thanks in advance,
Fred Brown
I want to cancel a certain key in JavaScript.
To do so, I catch the event in OnKeyPress and cancel the default:
<head>
....
function f(evt)
{
var evt = (evt) ? evt : ((window.event) ? window.event : "")
...
evt.returnValue = false; // IE
evt.preventDefault(); // dom 2 (also tried without this here)
return false; // netscape
}
....
<body>
....
<TEXTAREA Name=demoTextarea ROWS=10 COLS=50 OnKeyPress="f(event)">
</TEXTAREA>
IE works fine.
Safari will not cancel the key.
I also checked to see if the textArea value already had received the
key before this handler. It had not.
Any ideas?
Thanks in advance,
Fred Brown