faqts : Computers : Programming : Languages : JavaScript : Event handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 35 people (37%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How do I cancel a key press in NS6, Mozilla and other DOM compatible browsers?

May 30th, 2001 02:24
Spiff Spaceman, Ragnar Storstrøm,


with preventDefault():
function Fct(myEvent)
{myEvent.preventDefault();}
<input type="text" size="5" id="Fld">
and
document.getElementById("Fld").addEventListener("keypress",Fct,true);