Alibabacloud.com offers a wide variety of articles about documentelement clientwidth, easily find your documentelement clientwidth information here online.
Detailed description of JavaScript web page Positioning
This article mainly introduces JavaScript web page positioning in detail. If you need it, you can refer to it for help.
Visible area width of the webpage: document. body. clientWidth
Visible area height: document. body. clientHeight
Visible area width of the webpage: document. body. offsetWidth (including the width of the edge)
Visible area height of the webpage: document. body. offsetHeight (in
Original article title: HTML: scrollleft, scrollwidth, clientwidth, offsetwidth
Author: Source: http://bbs.chinaunix.net
Core tips : HTML: scrollleft, scrollwidth, clientwidth, and offsetwidth: returns the scroll height of an object. Scrollleft: sets or obtains the scrolltop distance between the left edge of the object and the leftmost end of the currently visible content in the window: set or obtain th
description of clientWidth, offsetWidth, and scrollWidth is the same as above. You only need to change the height to the width.HoweverFF has different interpretations of clientHeight in different DOCTYPE, but not in xhtml 1 trasitional. This problem does not exist in other browsers.
Js get page height
The Code is as follows:
ScriptFunction getInfo (){Var s = "";S + = "visible area width of the webpage:" + document. body.
Core tips: HTML: scrollleft, scrollwidth, clientwidth, and offsetwidth: returns the scroll height of an object. Scrollleft: sets or obtains the scrolltop distance between the left edge of the object and the leftmost end of the currently visible content in the window: set or obtain the top visible content at the top of the object and in the window .....
HTML: scrollleft, scrollwidth, clientwidth, and offs
offsetLeft attributes.
ClientHeight
Obtains the height of an object, without calculating any margin, border, scroll bar, or padding that may be applied to the object.
Everyone has no objection to clientHeight and thinks it is the height of the visible area of the content, that is, the height of the area where the content can be viewed in the browser of the page, generally, the area below the last toolbar to above the status bar is irrelevant to the page content.
ClientLeft
Obtain the distance
1. Obtain the screen size through a browserScreen. widthScreen. heightScreen. availHeight // Obtain the screen height after removing the status barScreen. availWidth // Obtain the screen height after removing the status bar2. Obtain the size of the browser window content// HeightWindow. innerHeight | document.doc umentElement. clientHeight | document. body. clientHeight// WidthWindow. innerWidth | document.doc umentElement. clientWidth | document. bod
Before starting, create a smallfools. xml file with the following content:
The following operations are performed in the xml file.
Operation 1: Read the entire XML file and display it in the DataGrid:DataSet ds = new DataSet ();Ds. ReadXml (Server. MapPath ("smallfools. xml "));If (ds. Tables. Count> 0){This. DataGrid1.DataSource = ds. Tables [0]. DefaultView;This. DataGrid1.DataBind ();}
Operation 2: obtain the value of the first node
XmlDocument xmlDoc = new XmlDocument ();XmlDoc. Load (Server
Visible area width: document. body. clientwidth: the visible area of the webpage is high: document. body. visible area width of clientheight webpage: document. body. offsetwidth (including the width of the edge) visible area of the webpage Height: document. body. offsetheight (including the height of edges): Document. body. scrollwidth: The full text of the webpage is high: document. body. scrollheight the height of the webpage to be rolled: document.
A little research on obtaining the visible window size of various browsers.
In my local test:
It can be used in IE, Firefox, and opera
Document. Body. clientwidth
Document. Body. clientheight
It is very simple and convenient.
In the company's projects:
Opera is still in use
Document. Body. clientwidth
Document. Body. clientheight
However, ie and Firefox use
Document.doc umentelement.
The following operations are performed in the XML file.
Operation 1: Read the entire XML file and display it in the DataGrid:Dataset DS = new dataset ();DS. readxml (server. mappath ("smallfools. xml "));If (Ds. Tables. Count> 0){This. datagrid1.datasource = Ds. Tables [0]. defaultview;This. datagrid1.databind ();}
Operation 2: obtain the value of the first node
Xmldocument xmldoc = new xmldocument ();Xmldoc. Load (server. mappath ("smallfools. xml "));Xmlnode = xmldoc.
The fixed floating effect will inevitably produce jitter when dragging, and I still have a good liking for CSS. I found it and found it to the end of the world. It is pure CSS for a closer look, without JS effects, I think it is more streamlined than previously seen, and there is no need to nest excess DIV. Let's take a look at the CSS style section: The code is as follows:Copy code Body {background-image: url(text.txt);/* for IE6 */Background-attachment: fixed ;}# BottomNav {background-
In my local test: it can be used in IE, FireFox, and Opera.
Document. body. clientWidth
Document. body. clientHeight can be obtained, which is very simple and convenient.
In the company project, Opera still uses
Document. body. clientWidth
Document. body. clientHeight
However, IE and FireFox use
Document.doc umentElement. clientWidth
Document.doc umentElement. cl
In the process of creating a webpage, you sometimes need to know the exact position of an element on the webpage. In the following article, we will introduce how Javascript is used to create a webpage, you sometimes need to know the exact location of an element on a webpage.
The following tutorial summarizes the knowledge of Javascript in web page locating.
1. webpage size and browser window size
First, we need to clarify two basic concepts.
The whole area of a webpage is its size. Generally
I finally figured out why I used document. Body. clientheight, document. Body. offsetheight to get the correct value of the visible area of the webpage. The original culprit was the W3C standard !! Under the newly defined standard, document.doc umentelement. clientheight can get the correct values in IE and Firefox. The following article details the differences in obtaining the visible window sizes of various browsers:
In my local test:It can be used in IE, Firefox, and operaDocument. Body. clie
Document.doc umentelement. clientheight --> browser height
Document.doc umentelement. scrollheight height of the full text
Document.doc umentelement. Height of scrolltop rollback
It can be used in IE, Firefox, and operaDocument. Body. clientwidthDocument. Body. clientheightIt is very simple and convenient.In the company's projects:Opera is still in useDocument. Body. clientwidthDocument. Body. clientheightHowever, ie and Firefox useDocument.doc umentelement. clientwidthDocument.doc umentelemen
Function scroll (){// Alert (typeof document. getelementbyid ('xx'). style. Height );Document. getelementbyid ('xx'). style. Height = document.doc umentelement. clientheight + "PX ";}Window. onload = scroll;Window. onresize = scroll;
Follow the browser size to adjust the height of the XX element, which is passed in ff3.6, 3.6se, and IE8.
From: http://zyj7261349.javaeye.com/blog/841327
IE:
Document. Body. clientwidth ==> body object width
Document. Bod
The following tutorial summarizes the knowledge of Javascript in web page locating.
I. absolute size and relative size of webpages
First, we need to clarify two basic concepts.
The full area of a webpage is its absolute size. Generally, the absolute size of a webpage is determined by the content and CSS style sheet.
The relative size of a webpage refers to the part of the webpage seen in the browser window, that is, the size of the browser window, also known as viewport ).
The central box repres
The following tutorial summarizes the knowledge of Javascript in web page locating.
I. absolute size and relative size of webpages
First, we need to clarify two basic concepts.
The full area of a webpage is its absolute size. Generally, the absolute size of a webpage is determined by the content and CSS style sheet.
The relative size of a webpage refers to the part of the webpage seen in the browser window, that is, the size of the browser window, also known as viewport ).
The central box repres
When creating a webpage, you sometimes need to know the exact position of an element on the webpage. The following tutorial summarizes the knowledge of Javascript in web page locating.
I. absolute size and relative size of webpages
First, we need to clarify two basic concepts.
The full area of a webpage is its absolute size. Generally, the absolute size of a webpage is determined by the content and CSS style sheet.
The relative size of a webpage refers to the part of the webpage seen in the bro
Lt; script gt; functiongetInfo () {vars quot; s + quot; visible area width of the webpage: quot; + document. body. clientWidth; s + quot; visible area of the webpage: quot; + document. body. clientHeight; s + quot; webpage visibility
ScriptFunction getInfo (){Var s = "";S + = "visible area width of the webpage:" + document. body. clientWidth;S + = "visible area height of the webpage:" + document. bod
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.