spib
08-13-2002, 11:08 AM
Hi,
I'm using IE6 and when I hit the escape key in a textarea, I get a warning that the form will be reset. If I then hit cancel, the form is still reset (it is reset as soon as the escape key is pressed).
What I want to do is override IE's messagebox here and display my own. I have tried the following code which catches the escape key but doesn't cancel the event bubble.
function KeyPress()
{
if (window.event.keyCode == 27)
{
// User pressed escape in the form
window.event.cancelBubble = true;
window.alert("Cancelled Bubble");
return true;
}
}
<form onkeydown="KeyPress()">
...
Anyone have any clues on what I'm doing wrong here?
Cheers
James
I'm using IE6 and when I hit the escape key in a textarea, I get a warning that the form will be reset. If I then hit cancel, the form is still reset (it is reset as soon as the escape key is pressed).
What I want to do is override IE's messagebox here and display my own. I have tried the following code which catches the escape key but doesn't cancel the event bubble.
function KeyPress()
{
if (window.event.keyCode == 27)
{
// User pressed escape in the form
window.event.cancelBubble = true;
window.alert("Cancelled Bubble");
return true;
}
}
<form onkeydown="KeyPress()">
...
Anyone have any clues on what I'm doing wrong here?
Cheers
James