Javascript examples for DOM HTML Element:Embed
The src property sets or gets the src attribute in an embed element, which controls the address (URL) of the external file to embed.
Set the src property with the following Values
Value | Description |
---|---|
URL | Sets the address (URL) of the external file to embed. |
Possible values:
A String, representing the URL of the embedded file.
The following code shows how to return the URL of an embedded file:
<!DOCTYPE html> <html> <body> <embed id="myEmbed" src="helloworld.swf"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* www . j ava 2 s .co m*/ var x = document.getElementById("myEmbed").src; document.getElementById("demo").innerHTML = x; } </script> </body> </html>