Anchor rel 和 rev 屬性

定義和用法
rel 屬性可設置或返回到目標文檔的關(guān)系。
rev 屬性可設置或返回一個鏈接的反向關(guān)系。
rel (relationship) 屬性規(guī)定了從源文檔到目標文檔的關(guān)系。
rev (reverse) 屬性規(guī)定了從目標文檔到當前文檔的反向關(guān)系。
語法
設置 rel 屬性:
anchorObject.rel="relationship"
設置 rev 屬性:
anchorObject.rev="relationship"
返回 rel 屬性:
anchorObject.rel
返回 rev 屬性:
anchorObject.rev
兩個屬性均可采用下面的值:
值 | 描述 |
---|---|
alternate | 鏈接到一個備選的源。 |
stylesheet | 文檔外部樣式表 |
start | 鏈接到當前文檔的第一頁。 |
next | 鏈接到集合中的下一個文檔。 |
prev | 鏈接到集合中的前一個文檔。 |
contents | 鏈接到當前文檔的內(nèi)容目錄。 |
index | 鏈接到當前文檔的索引。 |
glossary | 鏈接到當前文檔術(shù)語表。 |
copyright | 鏈接到當前文檔的版權(quán)或隱私頁面。 |
chapter | 從當前文檔鏈接到一個章節(jié)。 |
section | 鏈接到文檔列表中的一個小節(jié)。 |
subsection | 鏈接到當前文檔列表中的子小節(jié)。(一個小節(jié)可擁有多個子小節(jié)。) |
appendix | 鏈接到文檔的附錄頁。 |
help | 幫助文檔 |
bookmark | 鏈接到一個書簽。 |
nofollow | nofollow標簽是由谷歌領頭創(chuàng)新的一個"反垃圾鏈接"的標簽,用于指示搜索引擎不要追蹤(即抓?。┚W(wǎng)頁上的帶有nofollow屬性的任何出站鏈接,以減少垃圾鏈接的分散網(wǎng)站權(quán)重! |
licence | |
tag | |
friend |
瀏覽器支持
所有主流瀏覽器都支持 rel 和 rev 屬性。
注意: 瀏覽器不以任何方式使用這些屬性。但是,搜索引擎可以使用這些屬性來獲得更多鏈接的信息。
實例
實例
返回當前文檔與鏈接文檔的關(guān)系:
<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>
<body>
<a id="func" rel="friend"
href="http://www.functravel.com/">Cheap Flights</a>
<script>
document.write(document.getElementById("func").rel);
</script>
</body>
</html>
以上實例輸出結(jié)果:
friend
嘗試一下 ?

更多建議: