IFrame height Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:IFrame

Description

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

Set the height property with the following Values

Value Description
pixels The height in pixels ("100px" or "100")

Return Value

A String, representing the height of the iframe, in pixels

The following code shows how to change the height of an iframe:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<iframe id="myFrame" src="http://java2s.com" height="200" width="250"></iframe>

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

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

</body>
</html>

Related Tutorials