我在stackoverflow中搜索了这个问题,但我没有找到一个好的解决方案, 所以,我的问题是,在我的扩展中,jQuery不起作用......
extension.xul:
<overlay xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'>
<script type='application/javascript' src='chrome://extension/content/jQuery.js'></script>
<script type='application/javascript' src='chrome://extension/content/extension.js'></script>
<toolbar id="nav-bar">
<toolbarbutton id="ext-toolbarbutton" label="extension" tooltiptext="extension" type="menu">
<menupopup>
<menuitem id="ext-toolbar-state" type="checkbox" label="Activate" accesskey="A" checked="true" oncommand="ext.disabled"/>
</menupopup>
</toolbarbutton>
</toolbar>
</overlay>
extension.js
function Ext(state){
this.state = state;
}
Ext.prototype.enable = function(){
$("#ext-toolbar-state").attr("oncommand", "ext.disabled");
}
Ext.prototype.disabled = function(){
$("#ext-toolbar-state").attr("oncommand", "ext.enable");
}
var ext = new Ext("enable");
谢谢!