Search code examples
javascriptxulpentaho

XUL and Javascript


I have the following XUL markup:

<?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>

I'm trying to get the JavaScript function sayHello() to work when the toolbarbutton logout is clicked however nothing occurs and no JavaScript errors occur as well.

Does anyone know how to get JavaScript working with XUL?

Thanks in advance!


Solution

  • Try with oncommand="sayHello('hello')"