DOM API - The "window" Object

This section provides a quick description of the 'window' object of the DOM API. A tutorial example is provided on changing browser window size through the 'window' object.

The DOM API provided by IE browser contains another useful object called "window", which has the following features:

To illustrate some nice features of the "document" object, I wrote this VBScript tutorial example:

<html>
<!-- Window_Object.html
 - Copyright (c) 1998 HerongYang.com. All Rights Reserved.
-->
<head>
<title>Window Object</title>
<script type="text/vbscript">
dim sizeID
sizeID = 0
function changeSize()
   if sizeID = 0 then
      window.resizeTo 300,300 
   elseif sizeID = 1 then
      window.resizeTo 400,400  
   elseif sizeID = 2 then
      window.resizeTo 500,500  
   elseif sizeID = 3 then
      window.resizeTo 600,600  
   end if
   sizeID = (sizeID+1) mod 4
end function
</script>
</head>
<body>
<p>Hello World!</p>
<p><form>
  <input type="button" value="Change" onClick="changeSize()"/>
</form></p>
</body>
</html>

Run this VBScript example in a Web browser, and click the "Change" button. The browser window will change its size each time you click the button.

For more tutorial examples on the "window" object, see the DOM API chapters in this book.

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

 Arithmetic Operations

 Numeric Comparison Operations and Logical Operations

 String Operations - Concatenation and Comparison

 Variable Declaration and Assignment Statement

 Expression and Order of Operation Precedence

 Statement Syntax and Statement Types

 Array Data Type and Related Statements

 Array References and Array Assignment Statements

 Conditional Statements - "If ... Then" and "Select Case"

 Loop Statements - "For", "While", and "Do"

 "Function" and "Sub" Procedures

 Built-in Functions

 Inspecting Variables Received in Procedures

 Error Handling Flag and the "Err" Object

 Regular Expression Pattern Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

IE Web Browser Supporting VBScript

 VBScript Support in IE Web Browsers

 Including VBScript Code with HTML "script" Tags

 Including VBScript Code as External Files

 DOM API - The "document" Object

DOM API - The "window" Object

 Event Listeners and Objects

 'vbscript:' Pseudo-URL Addresses

 IIS ASP Server Supporting VBScript

 WSH (Windows Script Host)

 References

 Full Version in PDF/EPUB