If the code doesn't work, begin the troubleshooting process by:
- Checking to see if there are any error messages displayed.
- Checking to be sure that you have not overlooked any of the common sources of problems listed below.
Locating Error Messages
Other browsers will generally shown no visible sign that an error has occurred. You will need to navigate menu items or settings to view error messages. Access error messages in Firefox through the Tools menu, Web Developer, Error Console. 
Common Sources of Problems
- Be sure that required external files are in place along with their script tags in the proper order with path specified correctly. Otherwise, the likely result will be one of the following error messages:
[something] is undefined, or
Object expected, or
[something] is not a function, or
- Missing DOM elements or problems with ID
'null' is null or not an object; in Firefox:
[something] is null.
- Missing or incorrect style specifications
- Be sure that any style specifications required by the code are in place and consistent with instructions and example documents. The code may fail silently or display incorrectly without them.
- Code not properly initialized
- Check that any necessary initialization routines are in place and that they are being properly invoked. Modern code will generally not display errors when not properly initialized.
- Syntax errors introduced during implementation
Common Syntax Error Messages
A few of the common syntax errors which may be inadvertently introduced during implementation are listed here along with their meaning and possible solutions.
- Unterminated string constant (or literal)
- Check to see whether you have inserted a carriage return in the middle of a string variable value or array element, or deleted a quote or have mismatched quote pairs. The line number in the error message will point you to the location.
- You can use double quotes or single quotes to enclose a string, but they must be in pairs. If you want an apostrophe to appear in your string enclosed in single quotes, put a backslash before the apostrophe.
- String variables may contain quoted html attributes, in which case it is easiest to use single quotes to enclose the variable content. Here is an example which also contains an apostrophe:
var msg = '<div class="info">Here\'s the content.</div>';
- Expected ')' or missing ) after argument list
- Perhaps you have left out a comma between array elements, or inserted an unescaped apostrophe in an array element enclosed in single quotes.
- Expected ']' or missing ] after argument list
- Same as above when using array literal syntax.
It is highly recommended that you check your documents in both Firefox and Internet Explorer before making them publicly available. Some problems or errors may be triggered in Internet Explorer but forgiven by Firefox and perhaps other browsers, or vice versa.
If you are encountering errors when working with object literals perhaps our brief tutorial on the subject would be of assistance.
- Some older less robust code may trigger errors when event handlers are activated, for example, when users hover over links set up for use by the code. ^