Closed Thread Icon

Topic awaiting preservation: Escape key woes... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8482" title="Pages that link to Topic awaiting preservation: Escape key woes... (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Escape key woes... <span class="small">(Page 1 of 1)</span>\

 
Dufty
Paranoid (IV) Inmate

From: Where I'm from isn't where I'm at!
Insane since: Jun 2002

posted posted 01-21-2003 13:40

Hi again.

Had a wee problem crop up and have just about worn out my fingers trying to search google for an answer.

Do any of you know a way to disable the [Esc] key in a web page?

I have a long form and some users have complained that hitting Esc resets it... bit frustrating I know, and unfortunately, I can't tell them to just be more careful.

*Sigh* If only I could remove the need for human interaction altogether!

Any ref material, or links in the right direction would mbe most appreciated.

Thanks again
Dufty

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 01-21-2003 13:57

I've tested the code below on IE5.5sp2

code:
function dieBitch()
{
return event.keyCode!=27
}
document.body.onkeydown = dieBitch



Hope that helps.

Mathieu "POÏ" HENRI

Dufty
Paranoid (IV) Inmate

From: Where I'm from isn't where I'm at!
Insane since: Jun 2002

posted posted 01-21-2003 14:45

Thanks poi.
I love creative variable names

Unfortunately though, it seems to not do what is required
(Did I miss something?)


poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 01-21-2003 15:02

Did I missed your point ? you simply wanted to prevent the ESC key to reset your long form ?

Ok, it would be better to replace document.body.onkeydown = dieBitch by document.onkeydown = dieBitch and put the script before the BODY

For which browser do you want that script ?
Among the ones I've tested ( NN4.02 / NN4.8 / Phoenix0.5 / IE5.5 ) only IE5.5 resets the form once ESC is pressed, and the script works fine with it. :

Dufty
Paranoid (IV) Inmate

From: Where I'm from isn't where I'm at!
Insane since: Jun 2002

posted posted 01-21-2003 15:40

Thanks again poi
This works just fine (IE6):

code:
function preventEscKeyReset()
{
return event.keyCode!=27
}

document.onkeydown = preventEscKeyReset



Yay!

Once again, disproving the method that is 'care in the community'.
Stick em all in an asylum, they may learn something!

« BackwardsOnwards »

Show Forum Drop Down Menu