Javascript Browser Screen height Property

Introduction

Get the total height of your screen:

var x = "Total Height: " + screen.height;

Click the button to display the total height of your screen, in pixels.

View in separate window

<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {//  w  ww  .  j a v  a 2 s. c  o  m
  var x = "Total Height: " + screen.height + "px";
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The height property returns the total height of the user's screen, in pixels.




PreviousNext

Related