在我的 xul 文件中:
<!DOCTYPE overlay >
<overlay id="custombutton-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="browserOverlay.js"/>
<!-- Firefox -->
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="custom-button-1"/>
</toolbarpalette>
<!-- button details -->
<toolbarbutton id="custom-button-1"
label="Custom"
tooltiptext="My custom toolbar button"
oncommand="xyz.showPanel()"
class="toolbarbutton-1 chromeclass-toolbar-additional custombutton"
/>
<panel id="thepanel">
<hbox align="start">
<image src="warning.png"/>
<vbox>
<description value="You have 6 new messages."/>
<hbox>
<button label="Read Mail"/>
<button label="New Message"/>
</hbox>
</vbox>
</hbox>
</panel>
</overlay>
当调用具有以下代码的函数“xyz.showPanel()”时:
var xyz = {
showPanel: function (e)
{
var button = document.getElementById('custom-button-1');
var panel = document.getElementById('thepanel');
panel.openPopup(button, 'after_start', 0, 0, false, false);
}
}
它在错误控制台中给了我错误,上面写着:
错误:TypeError:面板为空
我想在 Firefox 中显示类似“下载”工具栏按钮的面板
我是 Firefox 插件的新手,
那么单击工具栏按钮时如何显示面板?