[Javascript] capturing onkeydown in Mozilla
Flavio Gomes
flavio at economisa.com.br
Mon May 17 12:53:58 CDT 2004
Peter Brunone wrote:
>...and the 2004 "D'oh" award goes to... ME!
>
> I think I got mixed up because I've been assigning so many event
>handlers through script lately; that and the sleep deprivation probably
>had something to do with it.
>
> One question, though; if I use parens -- which indicates that
>I'm calling the function with no parameters -- how do I pick up the
>event object in the function? Or do I have to assign the handler in
>script for this to work?
>
>
onkeydown="ELB_CheckFilter(event)"
>Cheers,
>
>Peter
>
>-----Original Message-----
>From: javascript-bounces at LaTech.edu On Behalf Of Peter-Paul Koch
>
>
>
>> 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
>
>
--
Flavio Gomes
flavio at economisa.com.br
More information about the Javascript
mailing list