[Javascript] capturing onkeydown in Mozilla

Peter-Paul Koch gassinaumasis at hotmail.com
Sun May 16 06:36:23 CDT 2004



>     As the subject suggests, I'm trying to catch onkeydown in a text
>input field and call a function as a result.  If I do this,
>
><input type="text" name="countryList_searchBox"
>id="countryList_searchBox" onkeydown="alert('gabooga')" >
>
>I get the expected alert... BUT when I change the onkeydown event
>handler to
>
>onkeydown="ELB_CheckFilter"

onkeydown="ELB_CheckFilter()"

>which points to this function
>
>function ELB_CheckFilter(evt) {
>	alert("Checking event");
>	}
>
>I never get an alert!  What am I doing wrong?

You use inline event handlers, so you should actually call the function (ie. 
add brackets), instead of just assigning it to the event handler.

-------------------------------------------------------------------
ppk, freelance web developer
Interaction, copywriting, JavaScript, integration
http://www.quirksmode.org/
Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
------------------------------------------------------------------

_________________________________________________________________
Hotmail en Messenger on the move 
http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/




More information about the Javascript mailing list