How to get height and width of different browser in Javascript?

Submitted by: Administrator
Following examples illustrate the different ways to get height and width of different browser.

For Non-IE:
var Width;
var Height;
Width = window.innerWidth;
Height = window.innerHeight;
For IE 6+ in standards compliant mode :
Width = document.documentElement.clientWidth;
Height = document.documentElement.clientHeight;

For IE 4 compatible:
Width = document.body.clientWidth;
Height = document.body.clientHeight;
Submitted by:

Read Online Expert Developer JavaScript Job Interview Questions And Answers