【发布时间】:2011-07-14 10:41:21
【问题描述】:
如何在 xul 中制作停靠面板。它应该像在萤火虫中一样工作。我尝试过这样的事情:
myWindow = window.open("chrome://project/content/myWindow.xul", "someRandomName", "chrome");
而 myWindow.xul 是:
<?xml version="1.0" encoding="utd-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xul-overlay href="chrome://project/content/myPanel.xul"?>
<window id="dockedPanel" title="my super extension" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<hbox flex="1">
<vbox id="myPanel"/>
</hbox>
</window>
myPanel.xul 是我的面板,myPanel 是 myPanel.xul 中 vbox 的 id
当我像这样打开窗口时,它看起来很像我想要的,但所有按钮/其他组件都不起作用。例如,如果我在 myPanel.xul 中有按钮:
<button id="myButton" label="button" onclick = "jsScriptFromOtherFile.someFunction()"/>
如果我单击 myWindow 上的该按钮,则不会调用 someFunction。我不知道为什么,以及如何使它工作。
【问题讨论】:
-
您能否发布不起作用的完整示例。从你的描述看不清楚是什么问题。例如,我假设您在 XUL 文件中包含脚本文件,对吗?
标签: javascript xul docking