Main Page

JavaScript debugger

the next JavaScript command on the page is executed. The debugger is brought up with the file that con-
tains the executing JavaScript. Using this method, the line about to be run is highlighted in yellow. Lastly,
you can use the JavaScript
debugger
command to bring up the debugger from anywhere in your code:
var iSum = 1 + 2;
debugger;
var iProduct = iSum * 10;
When the code encounters the
debugger
command, code execution is halted and the debugger is
opened (making it very similar to the Break At Next Statement option).
The Window
The Microsoft Script Debugger is actually made up of a single window with three smaller utility win-
dows (see Figure 14-12).
Figure 14-12
The first utility window is labeled Running Documents. This window displays all instances of Internet
Explorer that are currently running, as well as all the documents that are loaded into each instance. By
clicking on the plus sign next to an icon, you can see not only the HTML file that is loaded, but also all
its associated JavaScript files. You can then bring up the source of any file by double-clicking on it in the
window.
The second utility window is labeled Call Stack and, as you might assume, this displays the call stack up
to the current breakpoint in the code. Double-clicking on an entry in the Call Stack window brings up
the source code for the function.
433
Error Handling
17_579088 ch14.qxd 3/28/05 11:41 AM Page 433


JavaScript EditorFree JavaScript Editor     Ajax Editor


©