The rel
property sets or gets the relationship between the
current document and the linked document.
rel |
Yes | Yes | Yes | Yes | Yes |
Return the rel property.
var v = linkObject.rel
Set the rel property.
linkObject.rel=relationship
Value | Description |
---|---|
alternate | Mark as an alternative version of the current document |
appendix | Mark as the appendix page for the current document |
chapter | Mark as a chapter |
contents | Mark as the table of contents for the current document |
copyright | Mark as the copyright for the current document |
glossary | Mark as the glossary page for the current document |
help | Mark as the help page for the current document |
index | Mark as the index page for the current document |
next | Mark as the next page |
offline | Mark as a location that contains a path to the CDF file |
prev | Mark the previous page |
search | Mark to an XML file in Open Search description format |
section | Mark as a section in a list of documents |
shortcut icon | mark an icon location |
sidebar | the bookmark panel |
start | used by search engines to show the first page |
stylesheet | the style sheet for the current document |
subsection | a subsection for the current document |
A String type value representing a space-separated list of relationship types.
The following code shows how to get the relationship between the current document and the linked document.
<!DOCTYPE html>
<html>
<head>
<link id="myLink" rel="stylesheet" type="text/css" href="styles.css">
</head><!-- w w w . j ava 2 s. c o m-->
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myLink").rel;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: