requirements. If you need more rigorous methods, you can use the followingCode(Download to www.css rain.cn ):
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
VaR
Scrollpos;
If
(
Typeof
Window. pageyoffset
! =
'
Undefined
'
)
{Scrollpos=Window. pageyoffset;}
Else
If
(
Typeof
Document. compatmode
! =
'
Undefined
'
Document. compatmode
! =
'
The document. compatmode is very helpful for developing compatible web pages. We all know that the rendering of the box model by IE is very different in standards mode and quirks mode, the interpretation of the Box Model in standards mode is the same as that in other standard browsers, but there is a big difference in quirks mode, without declaring doctype, by default, ie is in quirks mode. Therefore, for compatibility consideration, we may need to obtain the current document rendering method.
;cHeight=document.documentElement.scrollHeight;
3. Use js to check the rendering mode of the browser:
alert(document.compatMode );
The output has two possible values: backcompat-odd mode.
Css1compat -- standard mode
Attachment: Get JS Code for browser height and width
function getBrowerSize(){ var cWidth,cHeight; if(document.compatMode=="BackCompat"){ cWidt
Judging browser Rendering modedocument.compatmode== "Css1compat" Standard compatibility mode on, body object is document.documentelement, otherwise Document.bodyvar page_body= document.compatmode== "Css1compat"? document.documentelement:document.body;//document.compatmode== "BackCompat" Standard compatibility mode off, Body object is document.body, otherwise document.documentelementvar page_body=document.compatmode== "
Differences:Body is the body subnode In the DOM object, that is, the DocumentElement is the root node root of the entire node tree, that is, the In BackCompat mode, if no DTD is used:Copy codeThe Code is as follows:Document.doc umentElement. clientHeight = 0document. body. clientHeight = 618 In the standard mode of CSS1Compat, when using DTD:Copy codeThe Code is as follows:Document.doc umentElement. clientHeight = 618 document. body. clientHeight = 28
OverviewHTML is an abbreviation for the English Hyper Text mark-up Language (Hypertext Markup Language), which is a standard language (tag) for making Web pages. The equivalent of a uniform set of rules, everyone to abide by him, so that you can let the browser according to the rules of the markup language to explain it.The browser is responsible for translating the label into a user "readable" format, presented to the user! (Example: Djangomoan template engine)HTML Document Document tree DOCTYP
browser what HTML or XHTML specification to use to parse the HTML document;The difference between having and not
Backcompat: Standard compatibility mode is not turned on (or is called "weird" mode [Quirks modes], promiscuous mode)
Css1compat: Standard compatibility mode is turned on (or called strict mode [standards Mode/strict mode])
This property will be recognized and used by the browser, but if your page does not have a DOCTYPE
OverviewHTML is an abbreviation for the English Hyper Text mark-up Language (Hypertext Markup Language), which is a standard language (tag) for making Web pages. The equivalent of a uniform set of rules, everyone to abide by him, so that you can let the browser according to the rules of the markup language to explain it.The browser is responsible for translating the label into a user "readable" format, presented to the user! (Example: Djangomoan template engine)HTML Document DOCTYPEDOCTYPE tells
Document.compatmode is used to determine the rendering method used by the current browser.Backcompat: Standard compatibility mode is off.Css1compat: Standard compatibility mode is turned on.When Document.compatmode equals Backcompat, the width of the browser client area is document.body.clientWidth;When Document.compatmode equals Css1compat, the browser client area width is document.documentElement.clientWidth.Compatible with the code that gets the wi
Document mode in the development of seemingly rarely used, the most common is to get the page when the width of the high, such as the document width is high, the visible area wide high.IE's rendering of box models is very different in standards mode and quirks mode, and the interpretation of box models under standards mode is the same as other standard browsers, but in quirks mode it is very different. In the case of not declaring doctype, IE defaults to quirks mode. So for compatibility reasons
? Document.body.scrollTop:document.documentElement.scrollTop; return {x:sleft,y:stop}; }else if (Document.compatmode = = "Backcompat") {sleft = Document.body.scrollLeft; sTop = Document.body.scrollTop; return { X:sleft,y:stop}; } }
Sometimes it is useful to be able to determine the size of the viewport, for example, to make sure that the case section of the document is currently visible. A simple way to query the size of a viewport using a s
;
if ((/(\[[\w-]*?:|:checked)/). Test (E))
return false;
if (Is_descendant_selector_buggy) return false;
return true;
}
})(),
//===================================================
Sarafi and opera support this approach
Shoulduseselectorsapi:function () {
if (! Prototype.BrowserFeatures.SelectorsAPI) return false;
This determines whether case sensitive lookup is supported
if (selector.case_insensitive_class_names) return false;
if (! SELECTOR._DIV) Selector._div = new E
This article mainly introduces the use of CSS1compat in document. compatMode. For more information, see document. compatMode.
BackCompat: Disabled in standard compatibility mode. Browser width: document. body. clientWidth;
CSS1Compat: enabled in standard compatibility mode. Browser width: document.doc umentElement. clientWidth.
The Code is as follows:
Var d = document,Dd = d.doc umentElement,Db = d. body,Dc = d. compatMode = 'css1compat ',Dx = dc
Python development [front-end]: HTML and python development front-endHTML
HTML is short for Hyper Text Mark-up Language (Hypertext Markup Language). It is a standard Language for making web pages ). It is equivalent to defining a unified set of rules, and everyone will follow them, so that the browser can explain it according to the markup language rules.
The browser is responsible for translating tags into the format that users can understand and present them to users! (Example: djangomoan temp
the course of study, google and Mozilla Firefox are recommended).
3) Static webpage File Extension:. html or. htm
4) Browser-server in bs Mode
5) HTML is not a programming language, but a markup language)
6) HTML uses tag to describe Web pages
3. html Structure
1)
2)
3) The
4)
5) The text between
4. html tag format
Tag Syntax:
II. Introduction to common labels
1.
Purpose: declare the document resolution type (document. compatMode) to avoid the strange mode of the browser.
Document.
Html development basics, html Development
1 Doctype2 3 Doctype tell the browser what html or xhtml specifications are used to parse html document 4 5There is no difference6 7 BackCompat: The standard compatibility mode is not enabled (or the odd mode [Quirks mode], mixed mode) 8 9 CSS1Compat: if the standard compatibility mode is enabled (or the Strict mode [Standards mode/Strict mode]) 10 11 is recognized and used by the browser, but if your page doe
be explained in the test results. IE8 and below are not considered.
2. safari is not tested due to device restrictions. In addition, it is the same as the chrome kernel, and the reliability of standard support is not good.
3. earlier versions of chrome, firefox, and opera cannot be tested due to device restrictions. However, considering the browser's support for standards, these three browsers started to comply with W3C standards in early versions. In addition, these browsers are updated quickl
DOCTYPE HTML>HTML> Head> MetaCharSet= "UTF-8"> title>title> Head> Body> Body>HTML> All browsers support infrastructure tagsFirst, 1, must be the first line of the HTML document, located before the The DOCTYPE is a shorthand for document type (documents);is not an HTML tag; it is a directive that instructs the Web browser to write which HTML version of the page to use;No end tag;Insensitive to casing.2, the role.By default, the standard browser and IE are not the same re
, should note the comparison in detail:Window.onload =function(){ varBtntop = document.getElementById ("Btntop"); varTimer =NULL; Window.onscroll=function(){ varBacktop =Getscrolltop (); if(Backtop >= 20) {//the button at the top of the current viewport, which is greater than or equal to 20 o'clock, is displayedBtnTop.style.display = "Block"; }Else{BtnTop.style.display= "None"; } }; Btntop.onclick=function(){ //timed ExecutionTimer = SetInterval (function(){ var
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.