Viewing and Changing Values

While a script is running, you can use the Command window to view and change the values of variables and properties in the script. The Command window is live in the context of the current script, so that changes you make there can directly affect the currently executing script.

The commands, values, and properties that you can use in the Command window depend on the environment in which the debugger is running:

You can execute script commands any time that you are at a debugger breakpoint or have stepped from a breakpoint to other statements.

To view and change variable values

  1. Load the document and start the debugger. For details, see Starting Microsoft Script Debugger.

    For information about debugging Global.asa files, see Debugging a Global.asa File.

  2. Set at least one breakpoint.

  3. Return to the document and perform an action such as clicking a button or refreshing the document that causes the script to execute. The Script Debugger stops at the first breakpoint.

  4. From the View menu, choose Command Window.

    – or –

    Click on the Debug toolbar.

  5. To view the value of a variable or property, do one of the following, depending on what the current scripting language is:
    • If the language is VBScript, enter a command that generates output (such as ?), a space, and the variable to see. For example, enter ? Document.Title to see the title of the current document for a client script.

    • If the language is JScript, enter the name of the variable.

The value of the variable is displayed in the window. The following illustration shows an example in JScript:

To change the value of a variable, assign it a value using the syntax of the current script language, as in the following examples:
Document.Title = Document.Title & "  (Debugging)"
txtLoginName = "Admin"

See Also

Debugging Java Applications

Setting Breakpoints

Stepping Through Scripts

Viewing the Call Stack


© 1997 by Microsoft Corporation. All rights reserved.