Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

value of the menuitem clicked in toolbar

2 views
Skip to first unread message

Fxp

unread,
Jun 13, 2009, 5:39:25 AM6/13/09
to
Hi,

<toolbarbutton id="list1" type="menu">
<menupopup id="test2" onclick="alert(this.popupNode.value)">
<menuitem value="1" />
<menuitem value="2" />
<menuitem value="3" />
</menupopup>
</toolbarbutton>

I am trying to catch in the alert the value of the clicked menuitem.
It seems that it doesn't work at all in a toolbar like it does in a
document or a side bar.

Has anyone any idea how to do this ?

Thank you for your help.

François

Dave Townsend

unread,
Jun 13, 2009, 5:52:46 AM6/13/09
to
On 13/06/2009 10:39, Fxp wrote:
> Hi,
>
> <toolbarbutton id="list1" type="menu">
> <menupopup id="test2" onclick="alert(this.popupNode.value)">
> <menuitem value="1" />
> <menuitem value="2" />
> <menuitem value="3" />
> </menupopup>
> </toolbarbutton>
>
> I am trying to catch in the alert the value of the clicked menuitem.
> It seems that it doesn't work at all in a toolbar like it does in a
> document or a side bar.

I'd be surprised if that code did what you want anywhere you mention.
Better would be to use event.target.value.

Fxp

unread,
Jun 13, 2009, 6:32:50 AM6/13/09
to
On Jun 13, 11:52 am, Dave Townsend <dtowns...@mozilla.com> wrote:

> Better would be to use event.target.value.

... and that was SO simple :-)

Thank you Dave

François

Neil Deakin

unread,
Jun 13, 2009, 8:25:55 AM6/13/09
to

And you should be using the command event, not the click event.

0 new messages