首页 > 语言 > JavaScript > 正文

html的DOM中document对象anchors集合用法实例

2024-05-06 14:47:06
字体:
来源:转载
供稿:网友

本文实例讲述了html的DOM中document对象anchors集合用法。分享给大家供大家参考。具体分析如下:

anchors 集合可返回对文档中所有 Anchor 对象的引用。

语法:
代码如下:document.anchors[]
例子:
代码如下:<html> 
 
<body> 
<a name="first">First anchor</a><br /> 
<a name="second">Second anchor</a><br /> 
<a name="third">Third anchor</a><br /> 
<br /> 
 
Number of anchors in this document: 
<script type="text/javascript"> 
document.write(document.anchors.length) 
</script> 
</body> 
 
</html>

希望本文所述对大家的javascript程序设计有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选