FASON (Coffee Man) IE and some distinction in DHTML under Mozilla

xiaoxiao2021-03-06  38

1. The interface on Dom is basically still consistent, but the test discovers that the DOM under Mozilla is more standard, even if some law, IE will have some little difference, but it is not relevant

2. On the event model, this area is different. The E. Target undermozilla is equivalent to Event.Srcelement under IE, but the details are different, the latter is returning an HTML ELEMENT and the E.TARGET returns a node, That is to say, including text nodes, the method can be like this var trg = e.target; while (Trg.NodeType! = 1) TRG = trg.parentnode;

E.WHICH under mozilla is quite right with Event.Keycode under IE

Compared to E.Layerx, E.Layery, E.Pagex, E.Pagey ... you can take a look at http://fason.nease.net/mozilla/dom/ Event part

Event Binding Mozilla with AddeventListener, RemoveEventListener, corresponding IE Attachevent, DetatChevent

3. The object is directly document.getlementByid, if you need to be compatible with IE4, you can add Document.all to determine the reference to form element to standard some var oinput = document.FormName.Elements ["INPUT1"]

4. XML's application is more important, because IE is created by ActiveX, and Mozilla is already these objects (requires DOM2 support) XMLDOMDocument: var document (",", ", NULL) XMLHTTP: VAR Req = new xmlhtpRequest ()

5. InnerText is not supported in Mozilla, you need to use some Range skills to get its text

6.NsertAdjacenthtml is a more advantageous way, Mozilla can be compatible with the DOM method INSERTBEFORE

7. Some methods, such as Array, Date IE and Mozilla will also have some minor differences, which are not mentioned. . .

8. Delete an object, use DOM's approach is VAR P = Obj.ParentNode; p.RemoveChild (OBJ);

9.Select's Option increase and delete, no add and removehttp: //fason.nease.net/samples/js/moveoptions.html

10.Mozilla Problem, DOM2 has supported OnContextMenu, not using E.WHICH == 2 to determine 12.