Window object
Window Object
Window Object
The Window object represents the window open in the browser.
If the document contains frames (<frame> or <iframe> tags), the browser creates a window object for the HTML document and an additional window object for each frame.
Note: There is no public standard for the window object, but all browsers support it.
Window object properties
Properties | Description |
---|---|
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 the Document object. (See Object) |
#frames | Returns all named frames in the window. The collection is an array of Window objects, each of which contains a frame within the window. |
history | A read-only reference to the History object. Please parameter History object. |
innerHeight | Returns the height of the document display area of the window. |
innerWidth | Returns the width of the document display area of the window. |
length | Set or return the number of frames in the window. |
location | The Location object used for the window or frame. See Location object. |
name | Sets or returns the name of the window. |
navigator | A read-only reference to the Navigator object. Please parameterize the Navigator object. |
opener | Returns a reference to the window that created this window. |
outerHeight | Returns the outer height of the window, including toolbars and scroll bars. |
outerWidth | Returns the outer width of the window, including toolbars and scroll bars. |
pageXOffset | Set or return the X position of the current page 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 the Screen object. Please parameterize Screen object. |
screenLeft | Returns the x coordinate relative to the screen window |
screenTop | Returns relative to the screen The y coordinate of the window |
screenX | Returns the x coordinate relative to the screen window |
screenY | Returns the y coordinate relative to the screen window |
self | Returns a reference to the current window. Equivalent to the Window property. |
status | Set the text of the window status bar. |
top | Returns the top-most parent window. |
Window object methods
Method | Description |
---|---|
alert() | Displays an alert box with a message and a confirm button. |
blur() | Removes the keyboard focus from the top-level window. |
clearInterval() | Cancel the timeout set by setInterval(). |
clearTimeout() | Cancel the timeout set by the setTimeout() method. |
close() | Close the browser window. |
confirm() | Displays a dialog box with a message and confirm and cancel buttons. |
createPopup() | Create a pop-up window. |
focus() | Give keyboard focus to a window. |
moveBy() | can move the window by the specified pixels relative to its current coordinates. |
moveTo() | Move the upper left corner of the window to a specified coordinate. |
open() | Open a new browser window or find a named window. |
print() | Print the contents of the current window. |
prompt() | Displays a dialog box that prompts the user for input. |
resizeBy() | Resize the window according to the specified pixels. |
resizeTo() | Resize the window to the specified width and height. |
scroll() | |
scrollBy() | Scroll the content according to the specified pixel value . |
scrollTo() | Scroll the content to the specified coordinates. |
setInterval() | Call a function or calculate an expression according to the specified period (in milliseconds). |
setTimeout() | Calls a function or calculated expression after the specified number of milliseconds. |