decorative banner

Setting up JavaScript


    You can add JavaScripts to your document. You can also insert JavaScripts in the head section pane of the document window to allow a script to be executed while the visible section of the document is still being loaded.

To set up a JavaScript:

  1. Do any of the following:
    • To add a JavaScript to the body section of a page, drag the JavaScript icon from the Basic tab Basic set button of the Objects palette to your document window.
    • To add a JavaScript to the head section of a page, drag the Script icon from the Head tab Head set button of the Objects palette to the document window or the head section pane. Alternatively, you can click the JavaScript Editor button JavaScript Editor button  in the upper right of the document window. Then click the Create Script button Create Script button  on the toolbar in the JavaScript Editor.
    Illustration of the JavaScript icon and Script icon in the Objects palette with these callouts: A. JavaScript icon, and B. Script icon.
    The JavaScript icon and Script icon in the Objects palette A. JavaScript icon B. Script icon
  2. If it's not already selected, select the JavaScript icon in the document window, or the Script icon in the head section pane.
  3. In the Inspector, enter a descriptive name in the Name text box. Choose a target browser from the Language pop-up menu. The language version corresponding to your browser selection appears in the text box below the menu.
  4. To reference an external script file (which must have the .js extension), do one of the following:
    • Select Source and then enter a resource locator for your script file.
    • Click the Browse button to select a script.
    • Drag from the Point and Shoot button in the Inspector to a script in the site window.