This is a discussion on Calling a function on event - Mozilla ; Can anybody give me a little newbie help with calling a function stored in overlay. js on pressing a button? I have the following hello world example in which the function is called when a menu item is selected. I'm ...
Can anybody give me a little newbie help with calling a function
stored in overlay.js on pressing a button?
I have the following hello world example in which the function is
called when a menu item is selected. I'm a bit stuck because I don't
understand how the example works. Here it is:
overlay.xul
type="text/css"?>
xmlns="http://www.mozilla.org/keymaster/gatekeeper/
there.is.only.xul">
oncommand="HelloWorld.onMenuItemCommand(event);"/>
----------------------------------
I'm not sure how the oncommand part works with the javascript below.
It would be great if somebody could explain it or point to some docs
which do:
overlay.js
var HelloWorld = {
onLoad: function() {
// initialization code
this.initialized = true;
},
onMenuItemCommand: function() {
// Show hello dialog
alert("hello");
}
};
window.addEventListener("load", function(e) { HelloWorld.onLoad(e); },
false);
-----------------------------------------------
What I need to do is tie the function to a regular button inside a
window.
Many Thanks for any help,
Marcus