Window Object
The Window object is the top level object in the JavaScript
hierarchy.
The Window object represents a browser window.
A Window object is created automatically with every instance of a
<body> or <frameset> tag.
IE: Internet Explorer, F: Firefox, O: Opera.
Window Object Collections
Collection Description IE F O
frames[] Returns all named frames in the window 4 1 9
Window Object Properties
Property Description IE F O
closed Returns whether or not a window has been 4 1 9
closed
defaultStatus Sets or returns the default text in the 4 No 9
statusbar of the window
document See Document object 4 1 9
history See History object 4 1 9
length Sets or returns the number of frames in the 4 1 9
window
location See Location object 4 1 9
name Sets or returns the name of the window 4 1 9
opener Returns a reference to the window that 4 1 9
created the window
outerheight Sets or returns the outer height of a No No No
window
outerwidth Sets or returns the outer width of a window No No No
pageXOffset Sets or returns the X position of the current No No No
page in relation to the upper left corner of a
window's display area
pageYOffset Sets or returns the Y position of the current No No No
page in relation to the upper left corner of a
window's display area
parent Returns the parent window 4 1 9
personalbar Sets whether or not the browser's personal
bar (or directories bar) should be visible
scrollbars Sets whether or not the scrollbars should be
visible
self Returns a reference to the current window 4 1 9
status Sets the text in the statusbar of a window 4 No 9
statusbar Sets whether or not the browser's statusbar
should be visible
toolbar Sets whether or not the browser's tool bar
is visible or not (can only be set before the
window is opened and you must have
UniversalBrowserWrite privilege)
top Returns the topmost ancestor window 4 1 9
Window Object Methods
Method Description IE F O
alert() Displays an alert box with a message and 4 1 9
an OK button
blur() Removes focus from the current window 4 1 9
clearInterval() Cancels a timeout set with setInterval() 4 1 9
clearTimeout() Cancels a timeout set with setTimeout() 4 1 9
close() Closes the current window 4 1 9
confirm() Displays a dialog box with a message and 4 1 9
an OK and a Cancel button
createPopup() Creates a pop-up window 4 No No
focus() Sets focus to the current window 4 1 9
moveBy() Moves a window relative to its current 4 1 9
position
moveTo() Moves a window to the specified position 4 1 9
open() Opens a new browser window 4 1 9
print() Prints the contents of the current window 5 1 9
prompt() Displays a dialog box that prompts the user 4 1 9
for input
resizeBy() Resizes a window by the specified pixels 4 1 9
resizeTo() Resizes a window to the specified width and 4 1.59
height
scrollBy() Scrolls the content by the specified number 4 1 9
of pixels
scrollTo() Scrolls the content to the specified 4 1 9
coordinates
setInterval() Evaluates an expression at specified 4 1 9
intervals
setTimeout() Evaluates an expression after a specified 4 1 9
number of milliseconds