Windows & Frames in JavaScript


Creating a new window

This can also be done in HTML using an A HREF link tag and setting the TARGET attribute to "self". However, JavaScript will additionally allow you to set attriutes for the new window.

windowObject = window.open ("URL", "Name of window", "Features list");

The features list is a list of optional window attributes. If not set the default values will be used.

Timeouts

A Timeout allows one to get a script to do something for a specified amount of time. The window.setTimeout method allows specification of a time delay where a command will be executed after that period of time has passed.

ident = window.setTimeout ("alert ('Time's up !')", 10000);

Before a Timeout has elapsed that Timeout can be halted with window.clearTimeout (ident);

A Timeout Example

Dialog boxes

Working with frames in JavaScript

The frames array can be accessed by the frames array.