1. Window. Event
Symptom:
Document. Body. onclick = function (EV) {If (EV) console. Log (1); else console. Log (2 );}
IE8 or earlier does not support this method.
Document. Body. onclick = function () {If (window. Event) console. Log (1); else console. Log (2 );}
FF does not support this method.
Ie9 and chrome support both window. Event and Ev.
Solution:
Document. Body. onclick = function (EV ){
Ev = Ev? Ev: window. event;
If (EV) console. Log (1); elseconsole. Log (2 );
}
2. innertext and textcontent
Symptom:
Innertext and textcontext
Ie9 and chrome support both
IE8 supports innertext
FF supports textcontent
Solution:
TEXT = E. textcontent | E. innertext
3. innerhtml
Symptom:
In ie, the following statement is used: Table. innerhtml = content; when the HTML content of the table is dynamically modified, an unknown running error occurs ". Cause of error: in IE browser, the innerhtml attribute of table is read-only and cannot be changed. Similarly, thead, tfoot, and TR (the only exception is TD ). (Firefox can be used normally)
Solution:
1. Use the object model or DOM method of the table to dynamically modify the table, such as insertrow, insertcell, createtfoot, createthead, or apendchild.
2. Locate the table's TD and use TD's innerhtml for dynamic operations.
4. Li and Span
Symptom:
<Ul> <spanid = "test"> <li> FDFD </LI> </span> </ul>
Document. getelementbyid ('test'). innerhtml output in ie9: <li> FDFD
Chrome and FF are normal.
Solution:
You can change span to Div.