曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 3751|回复: 0
打印 上一主题 下一主题

获取框架的数量( window.frames.length)

[复制链接]

716

主题

734

帖子

2946

积分

超级版主

Rank: 9Rank: 9Rank: 9

积分
2946
跳转到指定楼层
楼主
发表于 2013-4-25 12:55:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
获得一个浏览器窗口中的所有框架数可以使用 window.frames.length 属性。

测试代码:

<html>
<head>
  <title>框架数量</title>
  <meta http-equiv="content-type" content="text/html;charset=utf-8">

  
</head>
<body>
    <iframe src="http://www.baidu.com" name="Frame1" width="200" height="200"> </iframe> <br><br>
    <iframe src="http://www.baidu.com" name="Frame2" width="200" height="200"> </iframe> <br><br>
    <iframe src="http://www.baidu.com" name="Frame3" width="200" height="200"> </iframe> <br><br>
    <iframe src="http://www.baidu.com" name="Frame4" width="200" height="200"> </iframe> <br><br>
   
    <script type="text/javascript" language="javascript">
    <!--
        document.write("本页面中一共有 ", window.frames.length, "个框架");
     -->
     </script>

</body>

</html>
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2024-4-30 02:06 , Processed in 0.076317 second(s), 22 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表