Home / code / javascript

Properties of the window object

The windows object is the top-level object for each window or FRAME and the parent object for the document, location and history objects.

Property explanation
defaultStatus A string value containing the default value displayed in the status bar.
frames An array of objects for each frame in a window. Frames appear in the array in the order in which they appear in the HTML code
innerHeight() Specifies the vertical size of the content area (in pixels). New in JavaScript 1.2
innerWidth() Specifies the horizontal size of the content area (in pixels). New in JavaScript 1.2
length An integer value indicating the number of frames in a window.
name A string value containing the name of the window or frame.
opener A reference to the window object containing the open() method used to open the current window.
pageXOffset Specifies the current X position of the viewable window area (expressed in pixels). New in JavaScript 1.2.
pageYoffset Specified the current Y position of the viewable window area (expressed in pixels). New in JavaScript 1.2.
parent A string indicating the name of the window containing the frameset.
personalbar [visible=true|false] Represents the Directories bar in Netscape Navigator and whether it is visible. New in JavaScript 1.2.
scrollbars [visible=true|false] Represents the scrollbars of the instant window and whether they are visible. New in JavaScript 1.2.
self An alternative for the name of the current window
status Used to display a message in the status bar; it's done by assigning values to property.
statusbar=[true,false,1,0] Specifies whether the status bar of the target window visible.
toolbar=[true,false,1,0] Specifies whether the toolbar of the target window is visible.
top An alternative for the name of the topmost window.
window An alternative for the name of the current window.
   
Methods Explanation
alert(message) Displays message in a dialog box.
back() Sends the user back to the previous URL stored in the history list. (Simulates a click on the Back button in the browser). New in JavaScript 1.2.
blur() Removes focus from the window. On many systems, it sends the window to the background.
captureEvents() Used in a window with frames (along with enableExternalCapture), if specifies that the window will capture all specified events.
clearInterval(intervalID) Cancels timeouts created with the setInterval method. New in JavaScript 1.2.
close() Closes the window
confirm(message) Displays message in a dialog box with OK and Cancel buttons. Returns true or false based on the button clicked by the user.
disableExtrenalCapture Prevents the instant window with frames from capturing events occurring in pages loaded from a different location. New in JavaScript 1.2.
enableExtrenalCapture Allows the instant window (with frames) to capturing events occurring in pages loaded from a different location. New in JavaScript 1.2.
find([strings],[true,false],[true,false]) Finds string in the target window. There are 2 true/false parameters: The first specifies the Boolean state of case sensitivity in the search; the second specifies whether the search is performed backward. New in JavaScript 1.2.
focus() Gives focus to the window. On many systems, it brings the window to the front.
forward() Sends the user to the next URL in the history list. (Simulates a user clicking the Forward button in the browser). New in JavaScript 1.2.
home() Sends the user to the user's homepage. New in JavaScript 1.2.
moveBy(horizontal, vertical) Moves the window according to the specified values horizontal and vertical. New JavaScript 1.2.
moveBy(x, y) Moves the top-left corner of the window to the specified location; x and y are screen coordinates. New in JavaScript 1.2
navigator(url) Loads url in the window.
open(url,name,features) Opens url in a window names name. If name doesn't exist, a new window is created with that name. features is an optional string argument containing a list of features for the new window. Click here for a list of features;
print() Prints the contents of a frame or window. It's the equivalent of the user pressing the Print button in the browser. New in JavaScript 1.2.
prompt(message,response) Displays message in a dialog box with a text entry field with the default value of response. The user's response in the text entry field is returned a string.
releaseEvents(eventType) Specifies that the current window should release events instead of capturing them so that these events can be passed to other object, perhaps further on in the event hierarchy. New in JavaScript 1.2.
resizeBy(horizontal, vertical) Resizes the window, moving from the bottom-right corner. New in JavaScript 1.2.
resizeTo(outerWidth, outerheight) Resizes the window, using outerWidth and outerHeight properties. New in JavaScript 1.2.
routeEvent(event) Sends or routes an event through the normal event hierarchy. New in JavaScript 1.2.
scrollBy(horizontal, vertical) Scroll the viewing area of the current window by the specified amount. New in JavaScript 1.2.
scrollTo(x, y) Scrolls the current window to the specified position, calculated in x and y coordinates, starting at the top-left corner of the window. New in JavaScript 1.2.
setInterval(function, msec, [args]) Repeatedly calls a function after the period specified by the msec parameter. New in JavaScript 1.2.
setInterval(expression, msec) Evaluates expression after the period specified by the msec parameter. New in JavaScript 1.2.
setTimeout(expression, time) Evaluates expression after time, which is a value in milliseconds. The timeout can be named with the following structure: name = setTimeOut(expression, time)
stop() Stops the current download. It's the equivalent of the user pressing the Stop button in the browser.
clearTimeout(name) Cancels the timeout with the name name
   
Event Handlers Explanation
onDragDrop Specifies the JavaScript code to execute when the user drops an object onto the window. 5Netscape Navigator 4.0 or higher)
onBlur Specifies the JavaScript code to execute when focus is removed from a window.
onError Specifies the JavaScript code to execute when a JavaSript error occurs while loading a document. It can be used to intercept JavaScript errors. Setting this event handler to null effectively prevents JavaScript errors from being displayed to the user.
onFocus Specifies the JavaScript code to execute when the window receives focus.
onLoad Specifies the JavaScript code to execute when the window or frame finishes loading
onMove Specifies the JavaScript code to execute when the user moves a window.
onResize Specifies the JavaScript code to execute when a user resizes the window.
onUnload Specifies the JavaScript code to execute when the document in the window or frame exited.

open(url,name,features)

Features Explanation
toolbar=[yes,no,1,0] Indicates whether the window should have a toolbar.
location=[yes,no,1,0] Indicates whether the window should have a location field.
directories=[yes,no,1,0] Indicates whether the window should have directory buttons.
status=[yes,no,1,0] Indicates whether the window should have a status bar.
menubar=[yes,no,1,0] Indicates whather the window should have menus.
scrollbars=[yes,no,1,0] Indicates whether the window should have scrollbars.
resizable=[yes,no,1,0] Indicates whether the window should be resizable.
width=pixels Indicates the width of the window in pixels.
alwaysLowered=[yes,no,1,0] Indicates (if true) that the window should remain below all other windows. (This feature has varying results on varying window systems.) New in JavaScript 1.2 !Scriptmust be signed to use this feature!
alwaysRaised=[yes,no,1,0] Indicates (if true) that the window should always remain the top-level window. (This feature has varying results on varying window systems.) New in JavaScript 1.2 !Scriptmust be signed to use this feature!
dependent[yes,no,1,0] Indicates that the current child window will die (or close) when the parent window does. New in JavaScript 1.2.
hotkeys=[yes,no,1,0] Indicates (if true) that most hot keys are disabled within the instant window. New in JavaScript 1.2.
innerWidth=pixels Indicates the width (in pixels) of the instant window's content area. New in JavaScript 1.2.
innerHeight=pixels Indicates the height (in pixels) of the instant window's content area. New in JavaScript 1.2.
outerWidth=pixels Indicates the instant window's horizontal outside width boundary. New in JavaScript 1.2.
outerHeight=pixels Indicates the instant window's horizontal outside height boundary. New in JavaScript 1.2.
screenX-pixels Indicates the distance that the new window is placed from the left side of the screen (horizontally). New in JavaScript 1.2.
screenY=pixels Indicates the distance that the new window is placed from the left side of the screen (vertically). New in JavaScript 1.2.
z-lock=[yes,no,1,0] Indicates that the instant window does not move through the cycling of the z-order; that is it doesn't rise above other windows, even if activated. New in JavaScript 1.2. Note: the script must be signed for this feature to work.
height=pixels Indicates the height of the window in pixels.

 

TOP

Latest script:

 

Books: