Đối tượng liên kết DOM HTML
Đối tượng liên kết
Đối tượng Liên kết đại diện cho một phần tử HTML <link>.
Truy cập một đối tượng liên kết
Bạn có thể truy cập phần tử <link> bằng cách sử dụng getElementById ():
Thí dụ
var x = document.getElementById("myLink");
Tạo một đối tượng liên kết
Bạn có thể tạo một phần tử <link> bằng cách sử dụng phương thức document.createElement ():
Thí dụ
var x = document.createElement("LINK");
Thuộc tính đối tượng liên kết
Property | Description |
---|---|
charset | Not supported in HTML5. Sets or returns the character encoding of the linked document |
crossOrigin | Sets or returns the the CORS settings of the linked document |
disabled | Sets or returns whether the linked document is disabled, or not |
href | Sets or returns the URL of the linked document |
hreflang | Sets or returns the language code of the linked document |
media | Sets or returns the media type for the link element |
rel | Sets or returns the relationship between the current document and the linked document |
rev | Not supported in HTML5. Sets or returns the reverse relationship from the linked document to the current document |
sizes | Returns the value of the sizes attribute of the linked resource |
type | Sets or returns the content type of the linked document |
Thuộc tính và sự kiện tiêu chuẩn
Đối tượng Liên kết cũng hỗ trợ các thuộc tính và sự kiện tiêu chuẩn .
Các trang liên quan
Tham chiếu HTML: thẻ <link> HTML