Window length 属性 | Window 对象

返回到:Browser 对象:Window 对象

定义和用法

length 属性返回在当前窗口中frames的数量(包括IFRAMES)。

语法

window.length

所有主要浏览器都支持 length 属性

实例

查找页面上的frames数量,并改变每一frame元素的src属性为”www.web176.com”:

<html>
<body>
 
<iframe src="http://www.microsoft.com"></iframe>
<iframe src="http://www.google.com"></iframe>
<iframe src="http://www.youtube.com"></iframe>
 
<script>
for (var i=0; i<frames.length; i++)
{
    frames[i].location="https://www.web176.com"
}
</script>
 
</body>
</html>

作者:terry,如若转载,请注明出处:https://www.web176.com/javascriptbook/brtips/3627.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2021年9月9日 下午3:23
下一篇 2021年9月9日 下午3:52

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注