--- title: Document.anchors slug: Web/API/Document/anchors tags: - API - Deprecated - Document - HTML DOM - Property - Reference browser-compat: api.Document.anchors translation_of: Web/API/Document/anchors --- {{APIRef("DOM")}} {{Deprecated_Header}} **`anchors`** は {{domxref("Document")}} インターフェイスの読み取り専用のプロパティで、文書中のすべてのアンカーのリストを返します。 ## 構文 ```js nodeList = document.anchors; ``` ### 値 {{domxref("HTMLCollection")}} です。 ## 例 ```js if (document.anchors.length >= 5) { dump("found too many anchors"); } ``` 文書中のアンカーを基に目次を作成して文書に挿入する例を以下に示します。 ```html