Skip to content

Instantly share code, notes, and snippets.

@pwlin
Created April 7, 2010 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwlin/358999 to your computer and use it in GitHub Desktop.
Save pwlin/358999 to your computer and use it in GitHub Desktop.
// create XUL element
function createToolbarButton() {
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var anitem = document.createElementNS(XUL_NS, "toolbarbutton");
anitem.setAttribute("id", "Testing-Doit-Button2");
anitem.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional");
anitem.setAttribute("label", "label");
anitem.setAttribute("tooltiptext", "Do it!");
anitem.setAttribute("oncommand", "testing_doit();");
return anitem;
}
function placeToolbarButton() {
var bar = document.getElementById("nav-bar");
var newitem = createToolbarButton();
bar.appendChild(newitem);
}
placeToolbarButton();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment