Window innerHeight Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window innerHeight

Description

The innerHeight property returns the inner height of a window's content area.

The property is read-only.

Return Value

A Number, representing the inner height of the browser window's content area, in pixels

The following code shows how to get the window's height and width:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

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

<script>
function myFunction() {//from www. j av a 2s.co m
    var w = window.innerWidth;
    var h = window.innerHeight;
    document.getElementById("demo").innerHTML = "Width: " + w + "<br>Height: " + h;
}
</script>

</body>
</html>
</html>

Related Tutorials