Javascript内置变量top和parent
来源:互联网 发布:什么美工刀片好 编辑:程序博客网 时间:2024/06/10 17:30
引用方法top:
该变量永远指分割窗口最高层次的浏览器窗口。如果计划从分割窗口的最高层次开始执行命令,就可以用top变量。
parent:
该变量指的是包含当前分割窗口的父窗口。如果在一个窗口内有分割窗口,而在其中一个分割窗口中又包含着分割窗口,则第2层的分割窗口可以用parent变量引用包含它的父分割窗口。
附:Window对象、Parent对象、Frame对象、Document对象和Form对象的阶层关系
Windwo对象→Parent对象→Frame对象→Document对象→Form对象,如下:
parent.frame1.document.forms[0].elements[0].value;
在JS中:window.location(window.location.href)和window.top.location(window.top.location.href)是一样的意思
可以通过top来调用任何一个frame,因为top指的是最外层的frameset,可以调用它里面的任何一个子元素frame。如:top.outterFrame1.location和top.innerFrame2.location等。
parent指的是当前窗口(frame)的父窗口(frameset)可以调用它里面的任何一个子元素frame。如:parent.innerFrame1.location和parent.innerFrame2.location等。
<html>
<head>
<title>top frame parent示例</title>
<script language="javaScript" type="text/javaScript">
window.location.href="http://www.baidu.com/";
</script>
</head>
<frameset id="outFrameset" rows="150,*,150" cols="*" border="5">
<frame name="frameName1" id="frameId1" src="a.html">
<frameset id="inFrameset" cols="150,*" rows="*">
<frame name="innerFrameName1" id="innerFrameId1" src="a.html">
<frame name="innerFrameName2" id="innerFrameId2" src="a.html">
</frameset>
<frame name="frameName2" id="frameId2" src="a.html">
</frameset>
</html
top:
该变更永远指分割窗口最高层次的浏览器窗口。如果计划从分割窗口的最高层次开始执行命令,就可以用top变量。
parent:
该变量指的是包含当前分割窗口的父窗口。如果在一个窗口内有分割窗口,而在其中一个分割窗口中又包含着分割窗口,则第2层的分割窗口可以用parent变量引用包含它的父分割窗口。
附:Windwo对象、Parent对象、Frame对象、Document对象和Form对象的阶层关系
Windwo对象→Parent对象→Frame对象→Document对象→Form对象,如下:
parent.frame1.document.forms[0].elements[0].value;
- Javascript内置变量top和parent区别
- Javascript内置变量top和parent区别
- Javascript内置变量top和parent
- window.top和window.parent
- javascript的top,parent,opener,iframe
- 通过<frameset>和<iframe>看JavaScript中window对象parent、self、top的区别
- javascript中的top与self.parent问题解决小记
- javascript--iframe的JS方法,用法!contentWindow 、parent、top、onload
- javascript--iframe的JS方法,用法!contentWindow 、parent、top、onload
- JavaScript中的window.parent ,window.top,window.self 等等
- Javascript中的window.parent ,window.top,window.self 详解
- javascript中的opener和parent
- window对象---- parent和top属性用于框架设计
- window.parent 和 window.top方法的使用
- window.parent 和 window.top方法的使用
- window.parent top.window
- top,parent,opener,iframe
- js parent top frame
- 凌晨4点的哈佛大学图书馆(自励篇)
- 游戏工具
- 预览和打开PDF文档
- XCode调试技巧之EXC_BAD_ACCESS中BUG
- samba移植到android
- Javascript内置变量top和parent
- Ubuntu 下更新adt 的问题
- delete from和truncate table的区别
- UIWebView的创建使用
- 在这里给大家演示一下地图缩放,旋转,视角控制
- (*)Mongodb的分片配置
- exec函数族的作用与讲解
- 基于jquery快速实现网页右下角按钮点击后滚动回顶端的功能
- Container With Most Water