- Extend Firefox!
- Development Overview
- Environment Setup
- Configuration Files
- Creating GUIs
- The Backend
Make sure you use the chrome URI so that Firefox can find the file correctly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
The first line defines a function named
return x; statement. If no return statement is provided than the function returns (void), which is ignored by the calling function.
alert() function call. Whenever Firefox is running code and sees a call such as
alert("I am here!");, Firefox will display a graphical error box with the given message. This is a wonderful way to determine if a certain area of code is being executed, what the current value of some variable is (i.e.
alert(myVar)), and more. Use
alert(), it is your friend!
Working with the DOM
This returns the object representing the tree element. At this point we can get and set various attributes related to the tree object. For example, to get the currently selected index we just use
To see a list of attributes and methods defined for the various element types just look them up in the XUL element reference mentioned earlier: http://xulplanet.com/references/elemref/. You can learn all about the tree element, for example, here: http://xulplanet.com/references/elemref/ref_tree.html.
- XUL Element Reference: http://xulplanet.com/references/elemref/ref_tree.html