by Stephen Wilson (c) 1996
&& (add) Anomolies in using Document Properties
(Insert fig 2.1 Web page with properties lableled)
You can easily change the value of properties directly by creating a command line with the name of the object on the right side and the value you wish to assign on the left. The following example would change the background color of the current Web page to red.
(&& insert fig 2.2 animate colors)
The setTimeout() method requires two elements to be enclosed in its parentheses. The first element is an expression to be evaluated or acted upon. The second element is the number of milliseconds (thousandths of a second) to be waited before the first action is undertaken.
setTimeout(expression to be evaluated, milliseconds)
In this script the action to be taken in each line is an assignment of a different background color using the document.bgColor = structure. The second element in each instance is the number of milliseconds to wait. So you can see after 1000 milliseconds (1 second) the background will be changed to white; after 1500 millisconds (one and a half seconds) the background will be changed to lightpink; and so on. After the script is loaded Netscape will change to colors at the intervals indicated. The delays are all relative to the starting time not to each other. That is, there is not a 1500 millisecond delay between white and light pink; rather there is a 500 millisecond delay. The display moves from white to shades of pink to shades of red.
Learn to be very careful. Also invite friends to look at your code. Fresh eyes are good at picking up these kinds of errors.
&& not sure this works
&& title text - Missing
??Some document properties can only be read and not modified by scripts. For example, the identification properties of title, lastModified, and referrer cannot be set. The element properties can be set but they cannot be reflected in the page currently being displayed; that is, the current title does not change in the title area of the window. These properties can be established for new pages which will show up when loaded. (&&I couldn't get links or titles to work)
You are not restricted to the built-in properties that Netscape provides. You can define any name you want for a property and then using the "dot" notation assign values to that property. For example, imagine you wanted to define a new property of a document called firstline to which you assign a value. Any further references will produce that value.
document.firstline = "Welcome to the Information Page"
(?&&?? insert fig2.5)
- This page created by Stephen Wilson, Professor Conceptual Design, SFSU (http://userwww.sfsu.edu/~swilson) email@example.com