HTML DOM Anchor rev Property
The HTML DOM Anchor rev property is used to set or return the value of the rev attribute of the <a> element. The rev attribute is used to specify the relationship between the linked document and the current document.
Note: This property is not supported by HTML5.
Syntax:
-
It returns an anchor rev property.
anchorObject.rev
-
It is used to set the anchor rev property.
anchorObject.rev = "value"
Property Values:
- alternate: It defines an alternative version of the document i.e print page, translates, or mirror.
- stylesheet: It defines an external sheet for a document.
- start: It defines the first document in a selection.
- next: It defines the next document in a selection.
- prev: It defines a previous document in a selection.
- contents: It defines a table of contents for a document.
- index: It defines an index for the document.
- glossary: It defines an explanation of words used in the document.
- copyright: It defines a document that contains a piece of copyright information.
- chapter: It specifies the chapter of a document.
- section: It defines a section of a document.
- subsection: It specifies a subsection of a document.
- appendix: It specifies an appendix for the document.
- help: It specifies a help document.
- bookmark: It specifies a related document.
- nofollow: It is used by Google, to specify that the google search spider should not follow that link and is mostly used for paid links.
- license: It defines copyright information for the document.
- tag: It specifies a tag keyword for the current document.
Example 1: Below code illustrates that how to return the anchor rev property.
HTML
<!DOCTYPE html> < html > < body > < center > < h1 >w3wiki</ h1 > < h2 >DOM Anchor rev Property</ h2 > < p >Welcome to < a href = "https://www.w3wiki.net" id = "linkID" rev = "nofollow" target = "_self" > w3wiki </ a > </ p > < button onclick = "btnClick()" >Submit</ button > < p id = "paraID" style = "color:green;font-size:25px;" ></ p > <!-- Script to return Anchor rel property --> < script > function btnClick() { var x = document.getElementById("linkID").rev; document.getElementById("paraID").innerHTML = x; } </ script > </ center > </ body > </ html > |
Output:
Example 2: Below HTML code illustrates how to set the anchor rev property.
HTML
<!DOCTYPE html> < html > < head > < title > HTML DOM Anchor rev Property </ title > </ head > < body > < center > < h1 >w3wiki</ h1 > < h2 >DOM Anchor rev property</ h2 > < p >Welcome to < a href = "https://www.w3wiki.net" id = "linkID" rev = "nofollow" target = "_self" > w3wiki </ a > </ p > < button onclick = "btnclick()" >Submit</ button > < p id = "paraID" style = "color:green;font-size:20px;" ></ p > <!-- Script to set Anchor rel property --> < script > function btnclick() { var x = document.getElementById( "linkID").rel = "chapter"; document.getElementById("paraID") .innerHTML = "The value of the rev " + "attribute was changed to " + x; } </ script > </ center > </ body > </ html > |
Output:
Supported Browsers:
- Google Chrome
- Internet Explorer
- Opera
- Firefox
- Apple Safari