Javascript Window Object

In Javascript BOM consists of the different objects such as navigator, history, screen, location and document which are children of window object. The BOM is not standardized and can change based on different browsers.

Window Object

The window object is the parent of all objects in the object hierarchy. Basically it defines a broeser window.

The methods included in the window object are:

  • Alert : Display an alert dialog box with specified message.
  • Confirm : Display an alert dialog box with specified message and "Ok" and "Cancel" button.
  • Close : Close a window.
  • Open : Open a window.
  • Prompt : Display an dialog box containing a text field and message.
  • Blur : Remove focus from a window.
  • Focus : Set focus to a window.
  • ScrollTo : Scroll a window to a specified co-ordinate.
  • SetInterval : Evaluates given expression after a set interval.
  • SetTimeout : Evaluates given expression after a specified time out.

Window object also has a few properties which can be set. These properties are:

  • Location : This will be load the page or redirect the page specified by location.
  • Status : This will be display the text or message on the status bar of the browser.

Javascript Open and Close New Window Example

Javascript Window Object Example

Javascript Set status Example

Javascript Window Object Example

Javascript SetTimeout and SetInterval Example

Javascript Window Object Example