Setting a breakpoint allows you to specify where in a script you want to stop execution and start the debugger. For example, you might want to start the debugger at the beginning of a procedure or before a line that you suspect might cause an error.
You can:
OnLoad
event.To set a breakpoint on a specific line
– or –
For server scripts, start the debugger as a standalone application, and then choose the document to work with. For details, see Starting Microsoft Script Debugger and Choosing a Document to Work With.
Note Depending If you are setting a breakpoint in a Java program, select the entire statement.
– or –
Click on the Debug toolbar.
The line where you set the breakpoint is displayed in red to indicate that it is a breakpoint.
– or –
For server scripts, refresh the document in the browser.
The debugger stops at the first breakpoint it encounters. You can now execute (step through) lines one by one. See Stepping Through Scripts.
Setting a break for the next script statement in a document is particularly useful for debugging scripts that are executed as part of a document’s OnLoad
event. The script in the handler for this event has already been executed by the time the HTML document has completed loading, and any breakpoints set after the HTML document has completed loading are lost when the document is refreshed. Therefore, use the following procedure to debug script statements in an OnLoad
handler.
Note You cannot use this method to set breakpoints in a Global.asa file. For information about how to debug scripts in Global.asa files, see Debugging a Global.asa File.
To set a break for the next line of script
– or –
Click on the Debug toolbar.
The debugger stops at the first script line that is executed.
In some instances, the next statement that runs might not be in the document that you want to work with. For example, if you set a break for the next statement in one document in a frameset, the debugger will start if you trigger a script in a different document in the same frameset. In general, when you set a break for the next statement, you need to be aware that whatever script statement runs next will start the debugger.
See Also
© 1997 by Microsoft Corporation. All rights reserved.