window 什么时候你在某一页里看见了它 就是指的该页
self 同上
parent 指的是在框架中当前页的上一页(在当前页出现的话)<frameset name="fs" rows="20%,80%" onload=alert(name)> frameset 是框架标签 没有onload事件 下面的就有了
self 同上
parent 指的是在框架中当前页的上一页(在当前页出现的话)<frameset name="fs" rows="20%,80%" onload=alert(name)> frameset 是框架标签 没有onload事件 下面的就有了
self --引用当前窗口
parent --当前窗口 或 帧的父窗口 那么,wiodow是否在不同时刻代表不同对象呢?//不同时刻代表顶级对象
self是否就是window?//不一定
parent--当前窗口 是否就是window//不一定 -----我弄不清三者的关系。
<html>
<frameset name="fs" rows="20%,80%" onload=alert(name)> //这里为什么显示为空而不是fs //不知道
<frame name="f1" src="t1.htm" onload=alert(name)> //显示f1
<frame name="f2" src="t2.htm" onload=alert(name)> //显示f2
</frameset> fs.top,f2.top,f1.top=windowf2.parent.name=fs
f2.self.name=f2自己再alert("self.name="+self.name)等等看看
window -- 页本身
self -- 框架本身的页
parent -- 父框架的页1.htm
<HTML>
<HEAD>
<TITLE>f1</TITLE>
<script>
</script>
</HEAD>
<BODY>
f1
<input type="button" value="window.location" onclick="alert(window.location)">
<input type="button" value="self.location" onclick="alert(self.location)">
<input type="button" value="parent.location" onclick="alert(parent.location)">
</BODY>
</HTML>2.htm
<HTML>
<HEAD>
<TITLE>f2</TITLE>
</HEAD>
<BODY>
f2
<input type="button" value="window==self??" onclick="alert(window==self)">
</BODY>
</HTML>主框架页面
<html>
<head>
<title> Test </title>
<script>
function foo(){
// alert(event.srcElement.name)
}
alert(window.location);
</script>
</head>
<frameset name="fs" rows="20%,80%" onload="alert(0)"> //这里为什么显示为空而不是fs
<frame name="f1" src="1.htm" onload="foo()"> //显示f1
<frame name="f2" src="2.htm" onload="foo()"> //显示f2
</frameset>
</html>