Instructions
Use the Firefox Error Console
- 1In Mozilla Firefox, open the Error Console. You can do this either by pressing "ctrl+shift+J," or by selecting it in the Tools menu. Close any pages that you don't want to check for errors and clear the console.
- 2Load the page you want to check for errors. All of the JavaScript that runs on the page load will run, and any errors that these parts of your scripts generate will show in the error console. If you have any event driven scripts that you want to test, such as those triggered by a button press, do whatever causes them to execute.
- 3Any errors that occurred during this process will be listed in the console. You can click the link provided in the list to have Firefox open a window containing the script source.
Use the Firebug Plug-in for Firefox
- 4Download and install the Firebug plug-in for Firefox. Firebug is a web development utility that has become a standard debugging tool among web developers. Its offers a much more powerful set of features than the standard Error Console included with Firefox.
- 5Click the bug icon in the bottom right hand corner of your browser. This opens Firebug. There are several tabs at the top of Firebug--the two most useful for JavaScript debugging are the "Script" and "Console" tabs. Make sure these are both enabled by selecting "enable" in the drop-down menu of that tab.
- 6Visit the website you wish to debug. A list of errors will appear in the "Console" tab. Double clicking an item in this list will take you to the point in the script that caused the error.
- 7Use the tools in the "script" tab to test and examine the code more thoroughly. One of these tools is the "watch" area, in which you can type JavaScript statements and they will execute on the page, which is very useful for quick tests. Another useful part of the script tab is the ability to set a breakpoint. To do this, find the area of the script where you wish it to stop (or break), and click in the gray area to the left of it. A red circle will appear there indicating that this is where the debugger will start.
- 1
Read more: click here
Tidak ada komentar:
Posting Komentar