当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM anchors 集合

HTML DOM
DOM TableRow 对象
DOM Textarea 对象
DOM Window 对象

HTML DOM anchors 集合


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 466 ::
收藏到网摘: n/a

定义与用法

The anchors collection returns a reference to all Anchor objects in the document.
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>


尝试与演示

Return the number of anchors in a document
返回文档中锚点的数量

Return the innerHTML of the first anchor in a document
返回文档中第一个锚点中的文字

评论 (0) All

登陆 | 还没注册?