Computer >> Computer tutorials >  >> Programming >> HTML

HTML DOM Object Height Property


The HTML DOM Object Height property is used to set or return the height of an object. This height is set in pixels.

Following is the syntax to set the height of an object: objObject.height

Following is the syntax to return the height of an object −

objObject.height = pixels

Above, pixels is the value set for the height of object.

Let us now see an example to implement the DOM object height property −

Example

<!DOCTYPE html>
<html>
<body>
<object id="newObj" width="580" height="200" data="https://www.tutorialspoint.com/flex/samples/CSSApplication.swf" style="border:2px solid red"></object>
<p>Click to update the height.</p>
<button onclick="display()">Update Height</button>
<p id="myid"></p>
<script>
   function display() {
      document.getElementById("newObj").height = "350";
   }
</script>
</body>
</html>

Output

HTML DOM Object Height Property

Now, click the “Update Height” button to change the height −

HTML DOM Object Height Property