html的DOM中document對象anchors集合用法實例
更新時間:2015年01月21日 10:18:23 投稿:shichen2014
這篇文章主要介紹了html的DOM中document對象anchors集合用法,實例分析了anchors集合的功能及使用技巧,需要的朋友可以參考下
本文實例講述了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>
<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程序設計有所幫助。
相關文章
bootstrap treeview 擴展addNode方法動態(tài)添加子節(jié)點的方法
bootstrap-treeview 是一款基于Jquery+bootstrap的樹控件,這篇文章主要介紹了bootstrap treeview 擴展addNode方法動態(tài)添加子節(jié)點的方法,需要的朋友可以參考下2017-11-11
利用IntersectionObserver實現(xiàn)動態(tài)渲染的示例詳解
IntersectionObserver誕生已經(jīng)有幾年了,所以它的兼容性目前已經(jīng)達到可以使用的程度了。本文主要介紹了如何利用IntersectionObserver實現(xiàn)動態(tài)渲染,感興趣的可以了解一下2022-12-12
用js來定義瀏覽器中一個左右浮動元素相對于頁面主體寬度的位置的函數(shù)
用js來定義瀏覽器中一個左右浮動元素相對于頁面主體寬度的位置的函數(shù) 函數(shù)的參數(shù):elem元素、頁面主體寬度(如:990、950寬)、elem與頁面主體DIV的左邊距2012-01-01
詳解在微信小程序的JS腳本中使用Promise來優(yōu)化函數(shù)處理
這篇文章主要介紹了詳解在微信小程序的JS腳本中使用Promise來優(yōu)化函數(shù)處理,引入Promise確實能夠很好的解決異步回調函數(shù)的可讀性等問題,同時也使得我們調用的時候代碼簡潔一些,本文介紹如何在小程序的JS代碼里面使用Promise來封裝一些函數(shù)的做法2019-03-03

