Javascript examples for DOM:Document embeds
The embeds collection returns a collection of all <embeds> elements sorted as they appear in the HTML code.
Property | Description |
---|---|
length | Returns the number of <embed> elements in the collection. |
Method | Description |
---|---|
[index] | <embed> element with the specified index (starts at 0). |
item(index) | <embed> element with the specified index (starts at 0). |
namedItem(id) | <embed> element with the specified id. |
An HTMLCollection Object, representing all <embed> elements in the document.
The following code shows how to Find out how many <embed> elements there are in the document:
<!DOCTYPE html> <html> <body> <embed src="helloworld.swf"> <embed src="helloworld.swf"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w w w . ja va 2s. co m var x = document.embeds.length; document.getElementById("demo").innerHTML = x; } </script> </body> </html>