
The Object Scripting Model - The Window Object
The Window Object.
The Windows' methods.
Methods are instuctions that ask the Internet Explorer to perform some task.
The alert method
alert (text)
The alert displays Internet Explorers alert box with the text specified by text
displayed in it.
e.g.
- <SCRIPT LANGUAGE="VBScript">
- <!--
- alert ("Hello Everybody")
- -->
- </SCRIPT>
This displays the alert box with "Hello Everybody" displyed in it.
The clearTimeout method
clearTimeout(timerID)
Clears the timer specified by timerID
e.g.
- <SCRIPT LANGUAGE="VBScript">
- <!--
- clearTimeout(x)
- -->
- </SCRIPT>
Clears the timer x that will already have been specified by the setTimeout method.
The close method
close
If this method is used unqualified then this closes the current window, qualified it
closes the window specified.
e.g.
- <SCRIPT LANGUAGE="VBScript">
- <!--
- window.close()
- -->
- </SCRIPT>
This closes the window specified by window.
The confirm method
confirm(text)
Diplays a confirm box with the text displyed in it with an OK button
and a Cancel button. If the OK button is pressed then the value TRUE is returned,
if the Cancel button is pressed then the value FALSE is returned.
e.g.
- <SCRIPT LANGUAGE="VBScript">
- <!--
- dim x
- x = confirm("Yes or No")
- if x = TRUE then msgbox ("OK button pressed")
- if x = FALSE then msgbox ("Cancel button pressed")
- -->
- </SCRIPT>
This displays a confirm box, if the user presses the OK button then a message
box appears saying so, likewise for the Cancel button.
The get_document method
get_document()
Returns the document in the current window.
The navigate method
navigate(URL)
Navigates the current window to the URL specified.
- <SCRIPT LANGUAGE="VBScript">
- <!--
- navigate("http://www.shorrock.u-net.com")
- -->
- </SCRIPT>
This example navigates the current window to our home page.
The open method
open(url, windowName, windowFeatures, width, height)
Opens a new window with the specified URL loaded into it with the specified
window name, window features, width and height.
- <SCRIPT LANGUAGE="VBScript">
- <!--
- open("http://www.shorrock.u-net.com",,,100,100)
- -->
- </SCRIPT>
This opens a window to our home page that is 100 * 100 pixels in size.
The prompt method
prompt(text1, text2)
Displays a prompt box, that the user can enter text into. text1 specifies
the text displayed in the propmt box and text2 displays the text that will
appear by default in the input box.
- <SCRIPT LANGUAGE="VBScript">
- <!--
- dim text1
- dim text2
- dim user_response
- text1 = "Enter some text"
- text2 = "xxxxxxxxx"
- user_response = prompt(text1, text2)
- msgbox (user_response)
- -->
- </SCRIPT>
Displays a prompt box with "Enter some text" diplayed in it and "xxxxxxxxxx" diplayed
in the input box, the user enters some data which when the user OKs it, it is displayed
in a message box.
The setTimeout method
setTimeout(code, timeout)
Executes the code specified after the number of milliseconds specified by
timeout.
- <SCRIPT LANGUAGE="VBScript">
- <!--
- dim x
- x = setTimeout("msgbox("Hello")", 5000)
- -->
- </SCRIPT>
This example displays a message box with "Hello" in it after 5 seconds.
There are a number of hidden methods
- fireOnLoad
- fireOnParseComplete
- fireOnUnload
- getLoadComplete
- getPageHandle
- getStream
- postNavigateMessage