VBScript Tutorials - Herong's Tutorial Examples - Version 5.20, by Dr. Herong Yang

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:

  • The "window" object is a browser built-in object that represents the browser window that contains the current HTML document.
  • The "window" object offers a number of properties and methods to allow you
  • The "document" object and its "node" objects offers various methods to allow you to manipulate the window.

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

<html>
<!-- Window_Object.html
 - Copyright (c) 2015, 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 Codes with HTML "script" Tags

 Including VBScript Codes 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

 Printable Copy - PDF Version

DOM API - The "window" Object - Updated in 2015, by Dr. Herong Yang