Latest web development tutorials

HTML DOM Anchor rel and rev attributes

Anchor Object Reference Anchor objects

Definition and Usage

rel property sets or returns to the target document relationships.

rev property sets or returns the inverse relationship of a link.

rel (relationship) attribute specifies the source document to the target document from the relationship.

rev (reverse) attribute specifies the reverse relationship from the target document to the current document.

grammar

Set the rel attribute:

anchorObject.rel="relationship"

Setting rev attributes:

anchorObject.rev="relationship"

Back rel attributes:

anchorObject.rel

Back rev attributes:

anchorObject.rev

Two properties can use the following values:

描述
alternate 链接到一个备选的源。
stylesheet 文档外部样式表
start 链接到当前文档的第一页。
next 链接到集合中的下一个文档。
prev 链接到集合中的前一个文档。
contents 链接到当前文档的内容目录。
index 链接到当前文档的索引。
glossary 链接到当前文档术语表。
copyright 链接到当前文档的版权或隐私页面。
chapter 从当前文档链接到一个章节。
section 链接到文档列表中的一个小节。
subsection 链接到当前文档列表中的子小节。(一个小节可拥有多个子小节。)
appendix 链接到文档的附录页。
help 帮助文档
bookmark 链接到一个书签。
nofollow nofollow标签是由谷歌领头创新的一个"反垃圾链接"的标签,用于指示搜索引擎不要追踪(即抓取)网页上的带有nofollow属性的任何出站链接,以减少垃圾链接的分散网站权重!
licence
tag
friend


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support rel and rev attributes.

Note: The browser does not in any way to use these attributes.However, the search engine can use these properties to get more links.


Examples

Examples

Returns the relationship between the current document and the linked documents:

<html>
<body>

<a id="func" rel="friend"
href="http://www.functravel.com/">Cheap Flights</a>

<script>
document.write(document.getElementById("func").rel);
</script>

</body>
</html>

Examples of the above output:

friend

try it"


Anchor Object Reference Anchor objects