1. firefox does not support innerText or why. Firefox supports innerHTML but does not support innerText, so I checked it online and changed it to support textContent to implement innerText. However, the implementation is not so good. By default, extra spaces are retained. If textContent is not required, you can use innerHTML instead if the string does not contain HTML code.
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:
Reference content is as follows: 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.
- 2 pages in total:
- Previous Page
- 1
- 2
- Next Page