From http://hi.baidu.com/royaland/blog/item/eb909aee98785cf1b2fb954c.html
Collection Object Problems
Problem description: in IE, you can use () or [] to obtain collection class objects. In Firefox, you can only use [] to obtain collection class objects.
Solution: use [] to retrieve collection class objects.
Window. Event Problems
Problem description: window. event can only be run in IE, but not in Firefox, because Firefox Event can only be used in the event.
Solution: add the event parameter to the function where the event occurs and use VaR myevent = EVT? EVT :( window. event? Window. Event: NULL)
Example: <input type = "button" onclick = "dosomething (event)"/>
<Script language = "JavaScript">
Function dosomething (EVT ){
VaR myevent = EVT? EVT: (window. event? Window. Event: NULL)
...
}
Event. srcelement
Problem description: in IE, the even object has the srcelement attribute, but does not have the target attribute. In Firefox, the even object has the target attribute, but does not have the srcelement attribute.
Solution: Use srcobj = event. srcelement? Event. srcelement: event.tar get;
If you consider 8th issues, use myevent instead of event.
Innertext Problems
Problem description: innertext works normally in IE, but innertext does not work in Firefox.
Solution: Use textcontent instead of innertext in a non-IE browser.
Example:
If (navigator. appname. indexof ("Explorer")>-1 ){
Document. getelementbyid ("element"). innertext = "My text ";
} Else {
Document. getelementbyid ("element"). textcontent = "My text ";
}
[Note] innerhtml is supported by IE, Firefox, and other browsers at the same time. Others, such as outerhtml, are only supported by IE, so it is best not to use it.