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

 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 −

Updated on: 30-Jul-2019

71 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements