最新的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屬性


鏈接對象參考 鏈接對象