The document object is mainly used for some properties about windows. The main functions and usages of these properties are as follows.
To get the window size, different properties and methods need to be used for different browsers: to detect the true size of the window, you need to use the properties of window under netscape; to detect the body in the document under ie; to get the window size, you need to pay attention to the size of the root element, not the element.
The innerwidth property of the window object contains the internal width of the current window. The innerheight property of the window object contains the internal height of the current window.
The body attribute of the document object corresponds to the tag of the html document. The documentelement property of the document object represents the root node of the html document.
document.body.clientheight represents the current height of the window where the html document is located. document.body.clientwidth represents the current width of the window where the html document is located.
js get screen height var s = "";
s += "Visible area width of the web page: "+ document.body.clientwidth;
s += "Visible area height of the web page: "+ document.body.clientheight;
s += "Visible area width of the web page: "+ document.body.offsetwidth +" (including width of edges and scroll bars)";
s += "Visible area height of the web page: "+ document.body.offsetheight +" (including the width of the edge line)";
s += "The full text width of the web page body: "+ document.body.scrollwidth;
s += " Full text of the web page: "+ document.body.scrollheight;
s += " The web page is rolled out high: "+ document.body.scrolltop;
s += " The left of the web page being rolled away: "+ document.body.scrollleft;
s += " On the main part of the web page: "+ window.screentop;
s += " left of the web page text part: "+ window.screenleft;
s += " High screen resolution: "+ window.screen.height;
s += " Width of screen resolution: "+ window.screen.width;
s += " Screen Available Workspace Height: "+ window.screen.availheight;
s += " Screen Available Workspace Width: "+ window.screen.availwidth;
s += "Your screen settings are "+ window.screen.colordepth +" bit color";
s += "Your screen settings"+window.screen.devicexdpi +"pixel/inch";
The above JS implementation code to obtain screen height is all the content I have shared with you. I hope you can give you a reference and I hope you can support Wulin.com more.