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 event.preventBubble().
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to