Choose Tools, Macro, Microsoft Script Editor from the menu. Or use the keyboard shortcut, Alt+Shift+F11. The Microsoft Script Editor opens up as shown in Figure 24.21, although with a different view from that in typical HTML source viewing.
If the Script Editor is not already installed, you will be prompted to install it; follow the prompts.
The Script Editor view for typical HTML source (refer to Figure 24.8) does not open the Toolbox, Properties window, or Project Explorer window used to create or edit scripting code as shown in Figure 24.21.
Client-side scripts execute within the browser after the Web page has loaded; they are self-contained.
The scripting language can also be changed in the Properties window of the Script Editor under defaultClientScript.
After you've selected a scripting language, scroll to the insertion location in the Web page. Right-click and choose Insert Script Block, Client. This command is also available from the menu under Edit, Insert Script Block, Client.
After the container is created, you can start typing code.
If you prefer to select scripting functions from a list, click the Display an Object Member List button on the Text Editor toolbar (or press Ctrl+J). An object member list appears, as shown in Figure 24.23. Scroll and choose members as needed. After you've selected a member, you can click on the Display a Parameter List button in the Text Editor toolbar to view the proper syntax for a member.
The Microsoft Script Editor includes many of the amenities found in sophisticated programming environments, such as debugging and the capability to insert breakpoints. You can completely test and debug your script from within the Script Editor.
You may need to install the debugging features in the Script Editor before use. The Debug menu consists of only one item, Install Web Debugging, if debugging features aren't installed.
When the script works to your satisfaction, save the file and exit the Script Editor to return to Word.
Word generates the HTML code. If you resave the Web page from within Word, any manual changes you made from the Script Editor may be overwritten and lost.