源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

js中top/parent/frame概述及案例应用

  • 时间:2020-08-20 21:46 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:js中top/parent/frame概述及案例应用
[b]引用方法top[/b]: 该变量永远指分割窗口最高层次的浏览器窗口。如果计划从分割窗口的最高层次开始执行命令,就可以用top变量。 [b]parent[/b]: 该变量指的是包含当前分割窗口的父窗口。如果在一个窗口内有分割窗口,而在其中一个分割窗口中又包含着分割窗口,则第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等。
[u]复制代码[/u] 代码如下:
<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>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部