Anchor relandrevProperty

Anchor 对象参考手册Anchor Object

Definition and Usage

The rel attribute sets or returns the relationship to the destination document.

The rev attribute sets or returns the reverse relationship of a link.

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

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

Syntax

Set the rel attribute:

anchorObject.rel="relationship"

Set the rev attribute:

anchorObject.rev="relationship"

Return the rel attribute:

anchorObject.rel

Return the rev attribute:

anchorObject.rev

Both attributes can take the following values:

Value Description
alternate Links to an alternate source.
stylesheet External style sheet for the document
start Links to the first page of the current document.
next Links to the next document in the collection.
prev Links to the previous document in the collection.
contents Links to the table of contents of the current document.
index Links to the index of the current document.
glossary Links to the glossary of the current document.
copyright Links to the copyright or privacy page of the current document.
chapter Links from the current document to a section.
section Links to a subsection in the document list.
subsection Links to a sub-subsection in the current document list. (A subsection can have multiple sub-subsections.)
appendix Links to the appendix page of the document.
help Help document
bookmark Links to a bookmark.
nofollow The nofollow tag is an "anti-spam link" tag pioneered by Google. It is used to instruct search engines not to follow (i.e., crawl) any outbound links on a webpage that have the nofollow attribute, in order to reduce the dispersion of website weight by spam links!
licence  
tag  
friend  


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the rel and rev attributes.

Note: Browsers do not use these attributes in any way. However, search engines may use these attributes to obtain more information about the links.


Example

Example

Return the relationship between the current document and the linked document:

<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>

The output of the above example is:

friend

Try it yourself »


Anchor 对象参考手册Anchor Object Other extensions