ออบเจ็กต์ลิงก์ HTML DOM
เชื่อมโยงวัตถุ
วัตถุลิงก์แสดงถึงองค์ประกอบ HTML <link>
เข้าถึงวัตถุลิงก์
คุณสามารถเข้าถึง <link> องค์ประกอบโดยใช้ getElementById():
ตัวอย่าง
var x = document.getElementById("myLink");
สร้างวัตถุลิงก์
คุณสามารถสร้าง <link> องค์ประกอบโดยใช้ document.createElement() วิธีการ:
ตัวอย่าง
var x = document.createElement("LINK");
เชื่อมโยงคุณสมบัติของอ็อบเจ็กต์
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 |
คุณสมบัติและเหตุการณ์มาตรฐาน
ออบเจ็กต์ลิงก์ยังสนับสนุนคุณสมบัติและเหตุการณ์ มาตรฐาน อีกด้วย
หน้าที่เกี่ยวข้อง
อ้างอิง HTML: HTML <link> แท็ก