当前位置:Gxlcms > JavaScript > html的DOM中document对象anchors集合用法实例

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

时间:2021-07-01 10:21:17 帮助过:24人阅读

本文实例讲述了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程序设计有所帮助。

人气教程排行