of your user's browser.
The last line sets the event handler for the onLoad event to the function AppDisplay. The AppDisplay function uses the alert statement to display a message box showing three properties from the navigator object. Notice the use of the \n escape sequence to place each of the properties on a new line. You can use these properties to identify the browser being used, its version, and the underlying operating system.
For example, you can use this function to check which operating system a visitor uses. If you call this function in the onLoad event of the window, it will detect which operating system is running. The CheckOS function will redirect the browser to another URL if the user is using Windows 95, by using the indexOf method of the AppVersion property to see if it contains "95." It then sets the window object's location property to the new URL:
Note that the onChange event is handled by the NavTo function, and the Select control is passed to that function as an argument. Go back to the top of your file and add code for the NavTo function, that checks the selectedIndex property of the Select control to make sure it is not zero. Then set the window's location property to the selected option. Because the window object is the default object, it is not necessary to use the window.location syntax:
The window object contains several other objects in the browser's object model hierarchy. One of the most commonly used objects is the document object. The document object has several interesting properties. For example, the domain property specifies the domain name of the server that served the document, and the referrer property is the URL of the calling document. But it is the write method of the document object that gets the most use. For example, rather than displaying the name and e-mail address from your test form in a message box, you could use the open method of the window object to create a new window. Then, use the write method of the new window's document object to write in some HTML. First, change the Action property of your test form to call a ShowFields function and pass the form as an argument:
Then, add this procedure to open a new window and save a pointer to that window, in the NewWin variable. Notice that the third argument of the open method allows you to create a small, fixed-size window with no status bar or scroll bars. Then use the write method of the document object within the new window to write the HTML that will be displayed:
Add this code to your test form to create another select control with values for the window, navigator, document, and form objects. The onChange event will call the SelObject procedure and pass the select control: