HTML DOM Object Height Property

HTMLWeb DevelopmentFront End Technology

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

 Live Demo

<!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

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

raja
Published on 20-Jun-2019 11:09:11
Advertisements