Javascript DOM HTML Object height Property set

Introduction

Change the height of an <object> element to 200px:

document.getElementById("myObject").height = "200";

Click the button to change the height of the object element to 200px.

View in separate window

<!DOCTYPE html>
<html>
<body>

<object id="myObject" 
        width="100" 
        height="100" 
        data="video.mp4" 
        style="border:1px solid black"></object>

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

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

<script>
function myFunction() {//from  w w  w.  ja  v  a  2 s.co m
  document.getElementById("myObject").height = "200";
}
</script>

</body>
</html>

The height property sets or gets the value of the height attribute of an <object> element.

The height attribute specifies the height of an object, in pixels.

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

The height property returns a Number representing the height of the object, in pixels.




PreviousNext

Related