我有以下 XUL 标记:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="275" title="Placeholder"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:pen="http://www.pentaho.org/2008/xul" onload="mainToolbarHandler.init()">
<script type="text/javascript">
function sayHello(txt) {
alert(txt);
}
</script>
<toolbar id="mainToolbar">
<toolbarbutton id="logout" image="mantle/images/new_report_32.png" onclick="sayHello('hello')" tooltiptext="Logout"/>
</toolbar>
</window>
当单击工具栏按钮注销时,我试图让 JavaScript 函数 sayHello() 工作,但是什么也没发生,也没有 JavaScript 错误发生。
有谁知道如何让 JavaScript 与 XUL 一起工作?
提前致谢!