Definition and Usage innerWidth and innerHeight..
The innerWidth property returns the inner width of a window's content area.
The innerHeight property returns the inner height of a window's content area.
These properties are read-only.
Note: For IE8 and earlier, you can use the clientWidth and clientHeight properties
Return Value:A Number, representing the inner width and/or the inner height of the browser window's content area, in pixels
Syntax :
window.innerWidth
window.innerHeight
Differents way how to declare innerWidth and innerHeight in program.
CODING:The innerWidth property returns the inner width of a window's content area.
The innerHeight property returns the inner height of a window's content area.
These properties are read-only.
Note: For IE8 and earlier, you can use the clientWidth and clientHeight properties
Return Value:A Number, representing the inner width and/or the inner height of the browser window's content area, in pixels
Syntax :
window.innerWidth
window.innerHeight
Differents way how to declare innerWidth and innerHeight in program.
<!DOCTYPE html>
<html>
<body>
<p>For Internet Explorer 8, 7, 6, 5:<br>
document.documentElement.clientHeight<br>
document.documentElement.clientWidth<br>
or<br>
document.body.clientHeight<br>
document.body.clientWidth</p>
<div id="demo"></div>
<script>
var txt = "";
txt += "<b>InnerWidth: </b>" + window.innerWidth;
txt += "<b><br>InnerHeight: </b>" + window.innerHeight;
txt += "<b><br>OuterWidth: </b>" + window.outerWidth;
txt += "<b><br>OuterHeigh: </b>" + window.outerHeight;
document.getElementById("demo").innerHTML = txt;
</script>
</body>
</html>
<html>
<body>
<p>For Internet Explorer 8, 7, 6, 5:<br>
document.documentElement.clientHeight<br>
document.documentElement.clientWidth<br>
or<br>
document.body.clientHeight<br>
document.body.clientWidth</p>
<div id="demo"></div>
<script>
var txt = "";
txt += "<b>InnerWidth: </b>" + window.innerWidth;
txt += "<b><br>InnerHeight: </b>" + window.innerHeight;
txt += "<b><br>OuterWidth: </b>" + window.outerWidth;
txt += "<b><br>OuterHeigh: </b>" + window.outerHeight;
document.getElementById("demo").innerHTML = txt;
</script>
</body>
</html>
Comments
Post a Comment