Changes

Jump to: navigation, search

Mozilla.dev.tech.xul

1,761 bytes added, 20:21, 1 December 2006
FAQ
# [http://developer.mozilla.org/en/docs/Newsgroup_summaries:mozilla-dev-tech-xul:2006-11-10 Friday November 10, 2006]
# [http://developer.mozilla.org/en/docs/Newsgroup_summaries:mozilla-dev-tech-xul:2006-11-17 Friday November 17, 2006]
# [http://developer.mozilla.org/en/docs/Newsgroup_summaries:mozilla-dev-tech-xul:2006-11-24 Friday November 24, 2006]
# [http://developer.mozilla.org/en/docs/Newsgroup_summaries:mozilla-dev-tech-xul:2006-12-01 Friday December 1, 2006]
== FAQ ==
:*/
:</pre>
 
=== [http://groups.google.com/group/mozilla.dev.tech.xul/browse_thread/thread/55136a31f12497cc/22e2b0dadf941259#22e2b0dadf941259 How do I create XUL elements dynamically in JavaScript?] ===
 
Use the following snippet of code to add a new element under an existing element:
var elem = document.getElementById(XUL_ELEMENT_ID);
var node = document.createElement(XUL_ELEMENT_NAME);
node.setAttribute(ATTRIBUTE, VALUE);
node.setAttribute(ATTRIBUTE, VALUE);
elem.appendChild(node);
 
=== [http://groups.google.com/group/mozilla.dev.tech.xul/browse_thread/thread/df9104b140a1961b/8aa034e25417bc55#8aa034e25417bc55 How do I access XUL elements in a sidebar from the context menu JavaScript?] ===
 
The sidebar's content is a separate document, so you should use document.getElementById("sidebar").contentDocument.getElementById(...)
 
This is something you could see using the DOMi.
 
See also http://developer.mozilla.org/en/docs/Working_with_windows_in_chrome_code
 
=== [http://groups.google.com/group/mozilla.dev.tech.xul/browse_thread/thread/6098538f09e9822c/3e1ff364f7a986d5#3e1ff364f7a986d5 How can I include a .js document from inside a JavaScript document?] ===
 
Use the following snippet of code to reference a js file within a js file:
objScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
objScriptLoader.loadSubScript(strURL);
 
See http://www.xulplanet.com/references/xpcomref/ifaces/mozIJSSubScriptLoader.html for more information.
== UnAnswered Questions (UAQ) ==
1
edit

Navigation menu