我正在编写 firefox 扩展,我只是想知道是否可以在我包含在此 xul 中的 .js 文件中使用 xul 的“oncommand”。这可能听起来很愚蠢,但我决定要求 100% 确定这是不可能的(或可能的:))
我可以在这种情况下使用它(xul 文件):
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="quizy-toolbar-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"
label="test"
tooltiptext="test button"
oncommand="engine.iconCommand()"
/>
</toolbarpalette>
并且在我包含的 .js 中不起作用。
document.oncommand = function(e){
alert('tango down');
};
最佳答案
不,没有 oncommand
属性(观看 bug 246720 )。
但是你可以监听command
事件,这毕竟是正确的方式。
关于javascript无法使用xul的oncommand?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18614596/