Javascript DOM HTML Embed height Property set

Introduction

Change the height of an embedded file to 100 pixels:

document.getElementById("myEmbed").height = "100";

Click the button to change the height of the animation to 100 pixels.

View in separate window

<!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() {/*from w w w  . ja  va 2 s .co m*/
  document.getElementById("myEmbed").height = "100";
}
</script>

</body>
</html>

The height property sets or gets the value of the height attribute in an <embed> element.

The height attribute specifies the height of the embedded content, in pixels.

Use the width property to set or return the value of the width attribute in an <embed> element.

The height property accepts and returns a number type value.

Property Values

Value Description
pixels Set the height of the embedded content in pixels (e.g. height="100")

The height property returns a number representing the height of the embedded content, in pixels.




PreviousNext

Related