Embed width Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Embed

Description

The width property sets or gets the width attribute in an <embed> element.

Set the width property with the following Values

Value Description
pixels Sets the width of the embedded content in pixels

Return Value

A Number, representing the width of the embedded content, in pixels

The following code shows how to change the width of an embedded file to 500 pixels:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<embed id="myEmbed" src="helloworld.swf" width="200" height="200" style="border:1px solid">

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from w w  w  . j  a  v  a  2s  .  c  o  m*/
    document.getElementById("myEmbed").width = "500";
}
</script>

</body>
</html>

Related Tutorials