Graphics Programs Reference
In-Depth Information
To add a custom script to the home page:
1. Open the index.html page in Design view, and place the insertion point at the
end of the last line of content, and then press the Enter key.
2. In the Files panel, create a new folder in the local root folder named scripts . You
will place all the custom scripts you add to the site in the scripts folder.
3. Using the Files panel, copy the nu_randomImitation.js script located in the
Tutorial.07\Tutorial folder included with your Data Files into the scripts folder
you just created.
4. In the Common category of the Insert panel, click the Script button arrow , and
then click the Script button. The Script dialog box opens.
5. Click the Type button, and then click text/javascript , if necessary.
6. Next to the Source box, click the Browse button , and then double-click the
nu_randomImitation.js file in the scripts folder in the local root folder. The path
to the file is added to the Source box. See Figure 7-6.
Figure 7-6
Script dialog box
7. Click the OK button. This script creates the custom action of displaying one of the
quotations included in the script. The action occurs when the page is loaded in
the browser window (this is the event). The event handler is automatically onLoad.
(The home page is the object.) You cannot see anything in Design view.
Trouble? If a dialog box opens, saying you won't see this element unless invis-
ible elements are displayed, you might need to display invisible elements. Click
the OK button to close the dialog box, click View on the Application bar, point to
Visual Aids, and then click Invisible Elements, if necessary, to check the option.
8. Switch to Code view to see the code that was placed in the page. The code
in the home page tells the browser to insert the JavaScript located in the
nu_randomImitation.js page when it gets to this point in the home page. See
Figure 7-7.
 
Search WWH ::




Custom Search