当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM rel属性
The rel property sets or returns the relationship to a forward link.
rel属性可用来设置或返回当前文档与前往连接的关系。
The rel and rev properties work together.
rel和rev属性得一起工作
The rel (relationship) property specifies a relationship to the target. The rev (reverse) property specifies a reverse link from the target document to the current document.
rel属性指定目标关系。rev属性指定反向目标关系
These properties are used by search engines to provide a linked navigation menu.
这些属性被搜索用来提供被连接的导航菜单
anchorObject.rel=relationship |
Both properties can have one of the following values:
这两个属性可在下面这些值里拥有其中的一个:
Value 值 | Description 描述 |
---|---|
appendix | Link to the appendix page of a document 连接到文档的附录页 |
alternate | Link to an alternative source 连接到其它来源 |
bookmark | Link to a bookmark. Often used for "permalink" in web blogs 连接到书签。一些blog经常用到的。 |
chapter | Link to a chapter from the current documents 连接到当前文档的标题 |
contents | Link to the table of contents in the current document 连接到当前文档的表格内容 |
copyright | Link to copyright or policy page of the current document 连接到当前文档页著作权或政策部分 |
glossary | Link to glossary page of the document 连接到当前文档的词汇页 |
index | Link to the index page of the current document 连接到当前文档的索引页 |
next | Link to next page from the current document 连接到当前文档的下一页 |
prev | Link to the previous page from the current document 连接到当前文档的前一页 |
section | Link to a section in a list of documents 连接到文档清单列表 |
start | Link to the first page of the current documents. Used by search engines to show the first page 连接到当前文档的第一张页面。 |
subsection | Link to a sub-section in a list of current documents. ( Note that a section can have multiple sub-sections) 连接到当前文档的副清单列表。 |
The following example returns the relationship of the link:
下面的举例将返回连接的关系:
<html> <body> <p><a id="myAnchor" rel="index" href="http://www.ruanchen.com">Visit ruanchen.com</a></p> <script type="text/javascript"> x=document.getElementById("myAnchor"); document.write(x.rel); </script> </body> </html> |
Get the relationship of a link
得到连接的关系