The best Window object Tutorial In 2024, In this tutorial you can learn Window object,Window object properties,Window object methods,
Window object represents a browser window that opens.
If the document contains a frame (<frame> or <iframe> tag), the browser will create a window object for the HTML document, and create an additional window object for each frame.
Note: There areno open standards applied to the window object, but all browsers support the object.
Attributes | description |
---|---|
closed | Returns whether the window has been closed. |
defaultStatus | Sets or returns the default text window status bar. |
document | Read-only reference to the Document object. (See Object ) |
frames | Returns the window frame all named. This collection is an array of Window objects, each containing a Window object in the window frame. |
history | Read-only reference to the History object. Please arguments History objects . |
innerHeight | Returns the height of the window display area of the document. |
innerWidth | Returns the width of the display area of the document window. |
length | Sets or returns the number of the frame window. |
location | Location for the object window or frame. See Location object . |
name | Sets or returns the name of the window. |
navigator | Navigator object for read-only reference. Please arguments Navigator objects . |
opener | Returns to create this window window reference. |
outerHeight | Returning External height of the window, including toolbars and scroll bars. |
outerWidth | Returning External width of the window, including toolbars and scroll bars. |
pageXOffset | Sets or returns the current page with respect to the upper left corner of the window display area of the X position. |
pageYOffset | Sets or returns the current page with respect to the upper left corner of the window display area Y position. |
parent | Returns the parent window. |
screen | Screen object for read-only reference. Please Parameter Screen object . |
screenLeft | Back window relative to the screen coordinates x |
screenTop | Returns the y coordinate of the window relative to the screen |
screenX | Back window relative to the screen coordinates x |
screenY | Returns the y coordinate of the window relative to the screen |
self | It returns a reference to the current window. Equivalent to the Window property. |
status | Setting text window status bar. |
top | Returns the top-most parent window. |
方法 | 描述 |
---|---|
alert() | 显示带有一段消息和一个确认按钮的警告框。 |
blur() | 把键盘焦点从顶层窗口移开。 |
clearInterval() | 取消由 setInterval() 设置的 timeout。 |
clearTimeout() | 取消由 setTimeout() 方法设置的 timeout。 |
close() | 关闭浏览器窗口。 |
confirm() | 显示带有一段消息以及确认按钮和取消按钮的对话框。 |
createPopup() | 创建一个 pop-up 窗口。 |
focus() | 把键盘焦点给予一个窗口。 |
moveBy() | 可相对窗口的当前坐标把它移动指定的像素。 |
moveTo() | 把窗口的左上角移动到一个指定的坐标。 |
open() | 打开一个新的浏览器窗口或查找一个已命名的窗口。 |
print() | 打印当前窗口的内容。 |
prompt() | 显示可提示用户输入的对话框。 |
resizeBy() | 按照指定的像素调整窗口的大小。 |
resizeTo() | 把窗口的大小调整到指定的宽度和高度。 |
scroll() | |
scrollBy() | 按照指定的像素值来滚动内容。 |
scrollTo() | 把内容滚动到指定的坐标。 |
setInterval() | 按照指定的周期(以毫秒计)来调用函数或计算表达式。 |
setTimeout() | 在指定的毫秒数后调用函数或计算表达式。 |