【JavaScript】window对象_frames数组对象

window对象的frames属性是一个数组,它与window对象的parent、top等
对象属性,都是用于对HTML的帧标签(<frameset>或<iframe>)进行编程的
javascript对象。(利用parent.frames.来调用)

framedemo.html:
<html>
<head>
</head>
<frameset rows="20%,80%">
<frame name=top src="top.html">
<frame name=bottom src="bottom.html">
</frameset>
</html>

脚本代码最好不要编写在framedemo.html中,
而是写在frame各个区域的网页中。
top.html:
<input type=button value="刷新" 
onclink="window.parent.frames[1].loaction.reload()">
<!--刷新的是frame name=bottom-->


<input type=button value="刷新2" 
onclink="parent.frames.bottom.loaction.reload()">


<input type=button value="刷新3" 
onclink="parent.frames['bottom'].loaction.reload()">


<input type=button value="刷新4" 
onclink="parent.frames.item(1).loaction.reload()">


<input type=button value="刷新5" 
onclink="parent.frames.item('bottom').loaction.reload()">


<input type=button value="刷新6" 
onclink="parent.bottom.loaction.reload()">


<input type=button value="刷新7" 
onclink="parent['bottom'].loaction.reload()">


<!--个人觉得摔性能2与6比较好记-->

2.top属性:
例子:
top.html:
<frameset rows="20%,*">
    <frame name="a">
    <frame name="x" src="bottom.html">
</frameset>


bottom.html:
<frameset cols="30%,*">
    <frame name="b">
    <frame name="c" src="bottom_right.html">
</frameset>


bottom_right.html:
<script language="javascript">
     parent.parent.a.document.write("www.baidu.com");
</script>
____________________________________________________
<frameset rows="20%,*">
    <frame name="a">
    <frameset cols="30%,*">
        <frame name="b">
        <frame name="c" src="bottom_right.html">   
    </frameset>
</frameset>

bottom_right.html:

<script language="javascript">
     parent.a.document.write("www.baidu.com");
</script>

转载请注明出处:http://blog.csdn.net/acmman/article/details/44126609
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值