简体   繁体   中英

javascript can't use xul's oncommand?

I am writing firefox extension and I am just wondering if is it possible to use xul's 'oncommand' in .js file which I include to this xul. It may sounds stupid but I decided to ask to be 100% sure it's impossible (or possible :))

I can use it in this situation (xul file):

  <toolbarpalette id="BrowserToolbarPalette">
   <toolbarbutton id="quizy-toolbar-button"
      class="toolbarbutton-1 chromeclass-toolbar-additional"
      label="test"
      tooltiptext="test button"
      oncommand="engine.iconCommand()"
   />
 </toolbarpalette>

And in my included .js doesn't work.

 document.oncommand = function(e){
   alert('tango down');
 };

No, there is no oncommand property (watch bug 246720 ).

But you can listen for the command event, which is the right way after all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM