Thuộc tính liên kết neo
Thí dụ
Trả về giá trị của thuộc tính rel của một liên kết:
var x = document.getElementById("myAnchor").rel;
Định nghĩa và Cách sử dụng
Thuộc tính rel đặt hoặc trả về giá trị của thuộc tính rel của một liên kết.
Thuộc tính rel chỉ định mối quan hệ giữa tài liệu hiện tại và tài liệu được liên kết.
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
rel | Yes | Yes | Yes | Yes | Yes |
Cú pháp
Trả lại thuộc tính rel:
anchorObject.rel
Đặt thuộc tính rel:
anchorObject.rel = "value"
Giá trị tài sản
Value | Description |
---|---|
alternate | An alternate version of the document (i.e. print page, translated or mirror) |
author | The author of the document |
bookmark | A related document |
help | A help document |
licence | Copyright information for the document |
next | The next document in a selection |
nofollow | "nofollow" is used by Google, to specify that the Google search spider should not follow that link (mostly used for paid links) |
noreferrer | Specifies that the browser should not send a HTTP referer header if the user follows the hyperlink |
prefetch | Specifies that the target document should be cached |
prev | The previous document in a selection |
search | A search tool for the document |
tag | A tag (keyword) for the current document |
Chi tiết kỹ thuật
Giá trị trả lại: | Một chuỗi, đại diện cho mối quan hệ giữa tài liệu hiện tại và tài liệu được liên kết |
---|
Các ví dụ khác
Thí dụ
Đặt giá trị của thuộc tính rel thành "nofollow":
document.getElementById("myAnchor").rel = "nofollow";
Các trang liên quan
Tham chiếu HTML: HTML <a> thuộc tính rel
❮ Đối tượng neo