Object height Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Object

Description

The height property sets or gets the height attribute of an <object> element, which sets the height of an object, in pixels.

Set the height property with the following Values

Value Description
pixels Sets the height of the object, in pixels (e.g. height="100")

Return Value

A Number, representing the height of the object, in pixels

The following code shows how to change the height of an <object> element to 400px:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<object id="myObject" width="250" height="200" data="helloworld.swf"></object>

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

<p id="demo"></p>

<script>
function myFunction() {/*  ww w . j a v  a 2 s .  c  o m*/
    document.getElementById("myObject").height = '300';
    document.getElementById("demo").innerHTML = 'changed';
}
</script>

</body>
</html>

Related Tutorials