- 时间:2021-10-07 22:26 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:html的DOM中document对象anchors集合用法实例
本文实例讲述了html的DOM中document对象anchors集合用法。分享给大家供大家参考。具体分析如下:
anchors 集合可返回对文档中所有 Anchor 对象的引用。
[b]语法:
[/b]
document.anchors[]
[b]例子:
[/b]
<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程序设计有所帮助。