Javascript Reference - HTML DOM Embed height Property








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

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

Browser Support

height Yes Yes Yes Yes Yes

Syntax

Return the height property.

var v = embedObject.height

Set the height property.

embedObject.height=pixels




Property Values

Value Description
pixels Set the height of the embedded content in pixels

Return Value

A Number type representing the height of the embedded content in pixels.

Example

The following code shows how to change the height of an embedded file to 200 pixels.

<!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() {
    document.getElementById("myEmbed").height = "200";
}
</script>

</body>
</html>




Example 2

The following code shows how to get the height of an embedded file.

<!DOCTYPE html>
<html>
<body>
<embed id="myEmbed" src="notExist.swf" width="200" height="200" style="border:1px solid">
<p id="demo"></p>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
    var x = document.getElementById("myEmbed").height;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>