You need to use the keypress event to capture key events.
Here is a small example which captures enter and return, tab and
escape keys.
function edit1_onkeypress() {
switch (event.keyCode ) {
case 13: // Enter
case 10: // Return
event.returnValue = false;
search(edit1.value);
break;
case 9: // Tab
break;
case 27: // Escape
edit1.value = "";
break;
}
}
Best regards,
Benjamin
On Apr 14, 1:16 am, Yarlee <[email protected]> wrote:
> Hi,
>
> I have a edit box which takes some input from user. I want to trigger
> a function when user press enter or tab buttons. Is there a way I can
> capture the event. I tried using click, dblclick etc but no use. Is
> there a way I can capture the event of Enter or Tab being pressed.
>
> Thanks,
> Yarlee
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Desktop Developer Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Desktop-Developer?hl=en
-~----------~----~----~----~------~----~------~--~---