您的位置:首页 > Web前端 > HTML

browers and html dom 官方解读

2014-03-22 13:30 411 查看


Window Object

The window object represents an open window in a browser.

If a document contain frames (<frame> or <iframe> tags), the browser creates one window object for the HTML document, and one additional window object for each frame.

Note: There is no public standard that applies to the Window object, but all major browsers support it.
注解:窗口对象指的是一个在浏览器中打开的窗口。

TIPs : 如果一个html文档包含frames或iframe标签,则浏览器创建一个代表html文档的窗口对象,为每个frame创建一个额外的窗口对象


Window Object Properties

窗口对象的一些常用属性,不一一列举,可见w3school官网:window dom

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
返回当前窗口的所有frames框架,是一个数据所装,可以用parant.window.frames['frame_name']获取

lenth Returns
the number of frames (including iframes) in a window
不解释

location

Returns the Location object for the window (See Location object)

parent

Returns the parent window of the current window
返回当前窗口的父窗口


Window Object Methods

常用方法
alert(),confirm(),从close()什么的就不说了
重点说一下:
open() :
window.open(URL,name,specs,replace)

打开一个空白窗口
var
myWindow = window.open("","","width=200,height=100");

Open
a new window called "MsgWindow", and write some text into it:

var
myWindow = window.open("","MsgWindow","width=200,height=100");
myWindow.document.write("<p>T
c4a9
his is 'MsgWindow'. I am 200px wide and 100px tall!</p>");

再打开的窗口写入内容
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: