ฝังเอกสาร HTML DOM
ตัวอย่าง
จำนวน <embed> องค์ประกอบในเอกสาร:
let num = document.embeds.length;
ความหมายและการใช้งาน
คุณสมบัติembeds
ส่งคืนคอลเลกชันขององค์ประกอบ <embed> ทั้งหมดในเอกสาร
คุณสมบัติembeds
เป็นแบบอ่านอย่างเดียว
คำเตือน
เบราว์เซอร์ส่วนใหญ่ไม่รองรับแอปเพล็ตหรือปลั๊กอินแบบฝังอีกต่อไป
ตัวควบคุม ActiveX แบบฝังไม่ได้รับการสนับสนุนในเบราว์เซอร์ใดๆ อีกต่อไป
Shockwave Flash ยังถูกปิดในเบราว์เซอร์สมัยใหม่อีกด้วย
ข้อเสนอแนะ
หากต้องการฝังรูปภาพ ให้ใช้<img>
แท็ก
หากต้องการฝัง HTML ให้ใช้<iframe>
แท็ก
หากต้องการฝังวิดีโอหรือเสียง ให้ใช้ a <video>
หรือ<audio>
แท็ก
ดูสิ่งนี้ด้วย:
ไวยากรณ์
document.embeds
คุณสมบัติ
Property | Description |
length | The number of <embed> elements in the collection. |
วิธีการ
Method | Description |
[index] | Returns the element with the specified index (starts at 0). Returns null if the index is out of range. |
item(index) | Returns the element with the specified index (starts at 0). Returns null if the index is out of range. |
namedItem(id) | Returns the element with the specified id. Returns null if the id does not exist. |
คืนมูลค่า
พิมพ์ | คำอธิบาย |
รายการโหนด | HTMLCollection . องค์ประกอบ <embed> ทั้งหมดในเอกสาร เรียงตามที่ปรากฏในซอร์สโค้ด |
รองรับเบราว์เซอร์
document.embeds
เป็นคุณลักษณะ DOM ระดับ 3 (2004)
ได้รับการสนับสนุนอย่างเต็มที่ในเบราว์เซอร์ทั้งหมด:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 9-11 | Yes | Yes | Yes | Yes |