Javascript DOM HTML IFrame height Property set

Introduction

Change the height of an iframe:

document.getElementById("myFrame").height = "400";

Click the button to change the height of the iframe to 400px.

View in separate window

<!DOCTYPE html>
<html>
<body>

<iframe id="myFrame" src="https://www.java2s.com" height="200" width="250"></iframe>
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//from  w  w  w .  j  a v  a  2  s. c  o m
  document.getElementById("myFrame").height = "400";
}
</script>

</body>
</html>

The height property sets or gets the value of the height attribute in an iframe element.

The height attribute sets the height of an iframe.

The height property returns a String, representing the height of the iframe, in pixels.




PreviousNext

Related