Javascript examples for Browser Object Model:Window innerWidth
The innerWidth property returns the inner width of a window's content area.
The property is read-only.
A Number, representing the inner width of the browser window's content area, in pixels
The following code shows how to get the window's height and width:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w w w .j a v a2s . co m*/ var w = window.innerWidth; var h = window.innerHeight; document.getElementById("demo").innerHTML = "Width: " + w + "<br>Height: " + h; } </script> </body> </html> </html>