See this article in blue Article I feel that the author has summarized it well. At least some of them have never really known each other. These things should indeed be summarized. Unfortunately, this person is too lazy to collect and organize them here for your convenience!
1. Firefox cannot support innertext.
Firefox supports innerhtml but does not support innertext. It supports textcontent to implement innertext, but by default, redundant spaces are retained. If textcontent is not used, if the string does not contain HTMLCodeYou can also use innerhtml instead.
2. Prohibit the selection of webpage content:
JS: obj. onselectstart = function () {return false;} is generally used in IE ;}
Firefox uses CSS:-moz-user-select: None
3. Filter support (for example, transparent filter ):
IE: filter: alpha (opacity = 10 );
Firefox:-moz-opacity:. 10;
4. Capture events:
IE: obj. setcapture (), obj. releasecapture ()
Firefox: Document. addeventlistener ("mousemove", mousemovefunction, true );
Document. removeeventlistener ("mousemove", mousemovefunction, true );
5. Get the mouse position:
IE: event. clientx, event. clienty
Firefox: The event object needs to be passed by the event function.
OBJ. onmousemove = function (EV ){
X = eV. pagex; y = eV. Pagey;
}
6. Limitations of Div and other elements:
For example, set CSS ::{ width: 100px; Height: 100px; Border: #000000 1px solid;} Of a div ;}
In ie: div width (including Border width): 100px, div height (including Border width): 100px;
Firefox: div width (including Border width): 102px, div height (including Border width): 102px;
So when we drag windows compatible with IE and Firefox, we need to use some brains to write JS and CSS, and give you two tips.
1. Determine the browser type:
VaR isie = Document. All? True: false;
I wrote a variable. If the document. All syntax is supported, isie = true; otherwise, isie = false.
2. CSS processing in different browsers:
Generally, it can be used! Important Uses CSS statements first (only supported by Firefox)
For example: {border-width: 0px! Important; border-width: 1px ;}
In Firefox, this element has no border, and the Border Width under IE is 1px.
Differences between several pieces of XHTML and JavaScript and CSS IN NORMAL STATE
Adding this code at the beginning of the webpage is the so-called XHTML Standard <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Several differences under the XHTML standard:
1.document.doc umentelement and document. Body
You must use: document.doc umentelement to set page CSS in the code.
For example: document.doc umentelement. style. Overflow = 'hidd ';
The two coordinate attributes of overflow-X and overflow-y, XHTML, are not supported;
2.use document.doc umentelement to determine the distance between the obtained webpage window and the selected scroll bar.
The four metrics (clientwidth?clientheight=scrollleft?scrolltop=must use document.doc umentelement
When the parameter umentelement. removechild () is replaced, an error is returned;
In summary, only document.doc umentelement is used when clientwidth1_clientheight1_scrollleft1_scrolltopand document.documentelement.style.
3. After this standard is added, the border problem of IE has also changed. Now it is consistent with that of Firefox. Is this the advantage of XHTML-cross-browser standard?
As mentioned above:
Set CSS ::{ width: 100px; Height: 100px; Border: #000000 1px solid;} Of a div ;}
IE (normal): div width (including Border width): 100px, div height (including Border width): 100px;
Firefox (normal): div width (including Border width): 102px, div height (including Border width): 102px;
Added the XHTML standard (ie and Firefox ):
In IE (XHTML): div width (including Border width): 102px, div height (including Border width): 102px;
Firefox (XHTML): div width (including Border width): 102px, div height (including Border width): 102px;