Non so se ho capito bene, ma deve fare questo?
Codice:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="example-window" title="Example 6.1.3"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menu id="primo_menu" label="Primo Menu">
<menupopup>
<menuitem id="sottomenu" label="Sottomenu"/>
<menuitem id="sottomenu2" label="Sottomenu 2"/>
<menuitem id="sottomenu3" label="Sottomenu 3"/>
</menupopup>
</menu>
<script>
function buttonPressed(event)
{
alert('Premuto Sottomenu');
}
var button = document.getElementById("sottomenu");
button.addEventListener('command', buttonPressed, true);
</script>
</window>