最新的Web开发教程
 

的link rel属性

链接对象参考 链接对象

返回当前文档和链接文档之间的关系:

var x = document.getElementById("myLink").rel;

x的结果将是:

stylesheet
试一试»

定义和用法

该REL属性设置或返回一个空格分隔的列表,它定义了当前文档和所链接的文档之间的关系。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

该REL属性在所有主流浏览器的支持。

注:值“搜索”是不是在Opera和Safari支持。

注:值“侧边栏”是不是在IE,Safari浏览器或Chrome支持。


句法

返回REL属性:

linkObject .rel

设置相对属性:

linkObject .rel=relationship

属性值

Value Description
alternate Linked page is an alternative version of the current document
appendix Linked page is the appendix page for the current document
chapter Refers to a chapter
contents Linked page is the table of contents for the current document
copyright Linked page is the copyright/policy for the current document
glossary Linked page is the glossary page for the current document
help Linked page is the help page for the current document
index Linked page is the index page for the current document
next Refers to the next page
offline Refers to a location that contains a path to the CDF file
prev Refers to the previous page
search Refers to an XML file in OpenSearch description format
section Link to a section in a list of documents
shortcut icon Refers to an icon location
sidebar Refers to the bookmark panel
start Refers to the first page (used by search engines to show the first page)
stylesheet Linked page is the style sheet for the current document
subsection Linked page is a subsection for the current document

技术细节

返回值: 一个字符串,代表关系类型的空格分隔的列表

相关页面

HTML参考: HTML <link> rel属性


链接对象参考 链接对象