The Window Object

The Windows' methods.

Methods are instuctions that ask the Internet Explorer to perform some task.

The alert method
The alert displays Internet Explorers alert box with the text specified by text displayed in it.
<script language="VBScript">
<!--
alert ("Hello Everybody")
-->
</script>


The close method
If this method is used unqualified then this closes the current window, qualified it closes the window specified.
<script language="VBScript">
<!--
window.close()
-->
</script>


The confirm method
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.
<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 navigate method
Navigates the current window to the URL specified.
<script language="VBScript">
<!--
navigate("http://www.psacake.com")
-->
</script>


The open method
Opens a new window with the specified URL loaded into it with the specified window name, window features, width and height.
open(url, windowName, windowFeatures, width, height)
<script language="VBScript">
<!--
open("http://www.psacake.com",,,100,100)
-->
</script>

This opens a window to our home page that is 100 * 100 pixels in size.

The prompt method
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.
prompt(text1, text2)
<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
Executes the code specified after the number of milliseconds specified by timeout.
setTimeout(code, 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
  1. fireOnLoad
  2. fireOnParseComplete
  3. fireOnUnload
  4. getLoadComplete
  5. getPageHandle
  6. getStream
  7. postNavigateMessage


activex vbscript pop up alert confirm


Back To Top
© 1998 - 2017 psacake.com | My3C's

Version 7.2 | Advertise on this site