分类: Python/Ruby
2012-05-13 01:56:52
The window object represents an open window in a browser.
If a document contain frames ( or
| Property | Description |
|---|---|
| closed | Returns a Boolean value indicating whether a window has been closed or not |
| defaultStatus | Sets or returns the default text in the statusbar of a window |
| document | Returns the Document object for the window (See Document object) |
| frames | Returns an array of all the frames (including iframes) in the current window |
| history | Returns the History object for the window (See History object) |
| innerHeight | Sets or returns the inner height of a window's content area |
| innerWidth | Sets or returns the inner width of a window's content area |
| length | Returns the number of frames (including iframes) in a window |
| location | Returns the Location object for the window (See Location object) |
| name | Sets or returns the name of a window |
| navigator | Returns the Navigator object for the window (See Navigator object) |
| opener | Returns a reference to the window that created the window |
| outerHeight | Sets or returns the outer height of a window, including toolbars/scrollbars |
| outerWidth | Sets or returns the outer width of a window, including toolbars/scrollbars |
| pageXOffset | Returns the pixels the current document has been scrolled (horizontally) from the upper left corner of the window |
| pageYOffset | Returns the pixels the current document has been scrolled (vertically) from the upper left corner of the window |
| parent | Returns the parent window of the current window |
| screen | Returns the Screen object for the window (See Screen object) |
| screenLeft | Returns the x coordinate of the window relative to the screen |
| screenTop | Returns the y coordinate of the window relative to the screen |
| screenX | Returns the x coordinate of the window relative to the screen |
| screenY | Returns the y coordinate of the window relative to the screen |
| self | Returns the current window |
| status | Sets the text in the statusbar of a window |
| top | Returns the topmost browser window |
| Method | Description |
|---|---|
| alert() | Displays an alert box with a message and an OK button |
| blur() | Removes focus from the current window |
| clearInterval() | Clears a timer set with setInterval() |
| clearTimeout() | Clears a timer set with setTimeout() |
| close() | Closes the current window |
| confirm() | Displays a dialog box with a message and an OK and a Cancel button |
| createPopup() | Creates a pop-up window |
| focus() | Sets focus to the current window |
| moveBy() | Moves a window relative to its current position |
| moveTo() | Moves a window to the specified position |
| open() | Opens a new browser window |
| print() | Prints the content of the current window |
| prompt() | Displays a dialog box that prompts the visitor for input |
| resizeBy() | Resizes the window by the specified pixels |
| resizeTo() | Resizes the window to the specified width and height |
| scroll() | |
| scrollBy() | Scrolls the content by the specified number of pixels |
| scrollTo() | Scrolls the content to the specified coordinates |
| setInterval() | Calls a function or evaluates an expression at specified intervals (in milliseconds) |
| setTimeout() | Calls a function or evaluates an expression after a specified number of milliseconds |
The navigator object contains information about the browser.
| Property | Description |
|---|---|
| appCodeName | Returns the code name of the browser |
| appName | Returns the name of the browser |
| appVersion | Returns the version information of the browser |
| cookieEnabled | Determines whether cookies are enabled in the browser |
| platform | Returns for which platform the browser is compiled |
| userAgent | Returns the user-agent header sent by the browser to the server |
| Method | Description |
|---|---|
| javaEnabled() | Specifies whether or not the browser has Java enabled |
| taintEnabled() | Specifies whether or not the browser has data tainting enabled |
| Property | Description |
|---|---|
| availHeight | Returns the height of the screen (excluding the Windows Taskbar) |
| availWidth | Returns the width of the screen (excluding the Windows Taskbar) |
| colorDepth | Returns the bit depth of the color palette for displaying images |
| height | Returns the total height of the screen |
| pixelDepth | Returns the color resolution (in bits per pixel) of the screen |
| width | Returns the total width of the screen |
The history object contains the URLs visited by the user (within a browser window).
The history object is part of the window object and is accessed through the window.history property.
| Property | Description |
|---|---|
| length | Returns the number of URLs in the history list |
| Method | Description |
|---|---|
| back() | Loads the previous URL in the history list |
| forward() | Loads the next URL in the history list |
| go() | Loads a specific URL from the history list |
The location object contains information about the current URL.
The location object is part of the window object and is accessed through the window.location property.
| Property | Description |
|---|---|
| hash | Returns the anchor portion of a URL |
| host | Returns the hostname and port of a URL |
| hostname | Returns the hostname of a URL |
| href | Returns the entire URL |
| pathname | Returns the path name of a URL |
| port | Returns the port number the server uses for a URL |
| protocol | Returns the protocol of a URL |
| search | Returns the query portion of a URL |
| Method | Description |
|---|---|
| assign() | Loads a new document |
| reload() | Reloads the current document |
| replace() | Replaces the current document with a new one |