Change the width of an embedded file to 100 pixels:
document.getElementById("myEmbed").width = "100";
Click the button to change the width of the animation to 100 pixels.
<!DOCTYPE html> <html> <body> <embed id="myEmbed" src="video.mp4" width="200" height="200" style="border:1px solid"> <button onclick="myFunction()">Test</button> <script> function myFunction() {// w w w . ja v a 2s . co m document.getElementById("myEmbed").width = "100"; } </script> </body> </html>
The width
property sets or gets the value of the width attribute in an <embed> element.
The width attribute specifies the width of the embedded content, in pixels.
The width
property accepts and returns a number type value.
Property Values
Value | Description |
---|---|
pixels | Set the width of the embedded content in pixels (e.g. width="100") |
The width
property return a Number representing the width of the embedded content, in pixels.