The code in this section mainly uses some properties of the Document object regarding the window. The main functions and usage of these properties are as follows.
To get the size of the window, different properties and methods need to be used for different browsers: to detect the real size of the window, you need to use the properties of the Window under Netscape; under IE you need to go deep inside the Document to perform the body Detection; In the DOM environment, if you want to get the size of the window, you need to pay attention to the size of the root element , not the
element.
The innerWidth property of the Window object contains the inner width of the current window. The innerHeight property of the Window object contains the inner 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.
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> www.w3.org/1999/xhtml">
Please resize the browser window Please resize the browser window< /h2>
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31