J
Jeff Bowes
Hi,
I am trying to capture the keypress event to change the default
behaviour when the return key is pressed. However, on MSIE on Macintosh
(IE 5.x- at least all the versions I have tried on both OS 9 and OS
10) , when the onkeypress trigger is executed the events charCode and
keyCode are both 0. The event type also shows as "focus" instead of
"keypress". the following is snippets of the code I used.
Javascript:
function keyPress(e) {
if (!e) {
var e = window.event;
}
alert("event keycode is " + e.keyCode);
alert("event type is " + e.type);
alert("charcode is " + e.charCode);
key = (e.keyCode!=undefined) ? e.keyCode : key=e.which;
...
}
HTML:
<BODY onkeypress="return keyPress(event);">
Can anyone tell me how I can get around this bug and capture the key
code. The code performs correctly on IE on the PC.
thanks in advance,
Jeff Bowes
I am trying to capture the keypress event to change the default
behaviour when the return key is pressed. However, on MSIE on Macintosh
(IE 5.x- at least all the versions I have tried on both OS 9 and OS
10) , when the onkeypress trigger is executed the events charCode and
keyCode are both 0. The event type also shows as "focus" instead of
"keypress". the following is snippets of the code I used.
Javascript:
function keyPress(e) {
if (!e) {
var e = window.event;
}
alert("event keycode is " + e.keyCode);
alert("event type is " + e.type);
alert("charcode is " + e.charCode);
key = (e.keyCode!=undefined) ? e.keyCode : key=e.which;
...
}
HTML:
<BODY onkeypress="return keyPress(event);">
Can anyone tell me how I can get around this bug and capture the key
code. The code performs correctly on IE on the PC.
thanks in advance,
Jeff Bowes