The Window Object
The windows object has the following properties and methods:
Name | Description | Returns |
---|---|---|
alert(<msg>) | Displays a message dialog window. | void |
blur() | Unfocuses the window. | void |
clearInterval(<id>) | Cancels an interval timer. | void |
clearTimeout(<id>) | Cancels a timeout timer. | void |
close() | Closes the window. | void |
confirm(<msg>) | Displays a OK/Cancel prompt dialog. | boolean |
defaultView | Returns the Window for the active document. | Window |
document | Returns the Document object associated with this window. | Document |
focus() | Focuses the window. | void |
frames | Returns an array of the Window objects for the iframe elements. | Window[] |
history | Returns the browser history. | History |
innerHeight | Gets the height of the window content area. | number |
innerWidth | Gets the width window content area. | number |
length | Returns the number of nested iframe elements in the document. | number |
location | Returns the current document's location. | Location |
opener | Returns the Window that opened the current browsing context. | Window |
outerHeight | Gets the height of the window, including borders, menu bars, etc. | number |
outerWidth | Gets the width of the window, including borders, menu bars, etc. | number |
pageXOffet | Gets the number of pixels that the window has been scrolled horizontally from the topleft corner. | number |
pageYOffset | Gets the number of pixels that the window has been scrolled vertically from the top-left corner. | number |
parent | Returns the parent of the current Window. | Window |
postMessage(msg, origin) | Sends the message to another document. | void |
print() | Prompts the user to print the page. | void |
prompt(msg, val) | Displays a dialog prompting the user to enter a value. | string |
screen | Returns a Screen object describing the screen. | Screen |
screenLeft/screenX | Gets the number of pixels from the left edge of the window to the left edge of the screen. | number |
screenTop/screenY | Gets the number of pixels from the top edge of the window to the top edge of the screen. | number |
scrollBy(x, y) | Scrolls the document relative to its current position. | void |
scrollTo(x, y) | Scrolls to the specified position. | void |
self | Returns the Window for the current document. | Window |
setInterval(<function>, <time>) | Creates a timer that will call the specified function every time milliseconds. | int |
setTimeout(<function>, <time>) | Creates a timer that will call the specified function once after time milliseconds. | int |
showModalDialog(<url>) | Displays a pop-up window showing the specified URL. | void |
stop() | Stops the document loading. | void |
top | Returns the top-most Window. | Window |
Home
JavaScript Book
DOM
JavaScript Book
DOM
Window:
- The Window Object
- The Window Events
- window.alert() or alert()
- window.close()
- window.confirm() or confirm()
- window.find() displays find dialog
- window's outer width and height, inner height and width
- window.location
- window.moveBy(distance, distance)
- window.moveTo(x,y) moves the window to the upper-left coordinate
- window.open()
- window.print()
- window.prompt() and prompt()
- window.resizeTo(x,y) and window.resizeBy(xDelta,yDelta)
- window.scrollTo(x,y)
- window.screenLeft, window.screenX, window.screenTop, window.screenY
- window.setInterval() or setInterval()
- window.setTimeout() or setTimeout()
- Pop-up Blockers