Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

The Window object


May 06, 2021 JavaScript with HTML DOM Reference book


Table of contents


The Window object


The Window object

The Window object represents the window that opens in the browser.

If the document contains a frame, or a label, the browser creates a window object for the HTML document and an additional window object for each frame.

The Window object Note: There is no public standard applied to the window object, but it is supported by all browsers.


Window object properties

Property Describe
closed Returns whether the window has been closed.
defaultStatus Set or return the default text in the window status bar.
document A read-only reference to a Document object. (See object .) )
frames Returns all the named frames in the window. The collection is an array of Window objects, each with a frame in the window.
history A read-only reference to a History object. P lease parameter the History object.
innerHeight Returns the height of the window's document display area.
innerWidth Returns the width of the window's document display area.
length Set or return the number of frames in the window.
location The Location object used for a window or frame. See Location objects.
name Set or return the name of the window.
navigator A read-only reference to a Navigator object. Please parameter the Navigator object.
opener Returns a reference to the window that created this window.
outerHeight Returns the external height of the window, including the toolbar and scroll bar.
outerWidth Returns the outer width of the window, including the toolbar and scroll bar.
pageXOffset Set or return the current page's X position relative to the upper left corner of the window display area.
pageYOffset Set or return the Y position of the current page relative to the upper left corner of the window display area.
parent Return to the parent window.
screen A read-only reference to a Screen object. P lease parameter the Screen object.
screenLeft Returns x coordinates relative to the screen window
screenTop Returns the y coordinates relative to the screen window
screenX Returns x coordinates relative to the screen window
screenY Returns the y coordinates relative to the screen window
self Returns a reference to the current window. Equivalent to the Window property.
status Set the text for the window status bar.
top Returns the top-level parent window.

The Window object method

method describe
alert() Shows a warning box with a message and a confirmation button.
blur() Remove the keyboard focus from the top window.
clearInterval() Cancel the timeout set by setInterval ().
clearTimeout() Cancel the Timeout set by the setTimeout () method.
close() Close the browser window.
confirm() Display a dialog box with a message and a confirmation button and a cancel button.
createPopup() Create a POP-UP window.
focus() Give the keyboard focus to a window.
moveBy() The current coordinates of the can be moved to the specified pixel.
moveTo() Move the upper left corner of the window to a specified coordinate.
open() Open a new browser window or look up a named window.
print() Print the contents of the current window.
prompt() Displays a dialog that prompts users to enter.
resizeBy() Adjust the size of the window according to the specified pixel.
resizeTo() Adjust the size of the window to the specified width and height.
scroll()
scrollBy() Scroll content according to the specified pixel value.
scrollTo() Scroll content to the specified coordinates.
setInterval() Call the function or calculate the expression according to the specified cycle (in millisecond).
setTimeout() Call the function or calculate the expression after the specified millisecond number.