[Project_owners] textbox action

Neil neil at parkwaycc.co.uk
Sun Mar 5 19:54:34 EST 2006

Michael Bar-David wrote:

> another stupid question (I searched, but didn't get any result):
> I have the folowing code:
> <hbox>
>     <textbox id="text2trans" value=""/>
>      <button id="translate_bt" label="Translate" 
> oncommand="Translate()"/>
> </hbox>
> how do I make, that after writing int the textbox, and clicking 
> Return, the function Translate() will called ?

I know no easier way than to do <textbox onkeypress="if (event.keyCode 
== KeyEvent.DOM_VK_RETURN) Translate();">

Note that if you have other elements (e.g. <dialog>) listening for 
VK_RETURN you may also need to call event.preventDefault() and/or 

More information about the Project_owners mailing list