This article from: http://ailantian.bokee.com/6418694.html
The original article is as follows:
The javascript compatibility between Firefox and IE on the Internet is also much discussed.
Search for "Firefox Javascript compatibility" on Baidu"
Baidu can be used to find Chinese characters on Baidu.
It is generally used for applications such as document. all. It is generally changed to getelementbyid.
In addition, when a page has multiple forms, you need to pay attention to some issues.
The following are some more to be supplemented:
That is, firstchild and nextsbiling.
The function is provided below.CodeComparison
The Code comes from the Internet.
However, getnext and getfirstchild are different.
Next is the next node, which is at the same level and does not obtain its own subnode.
It may be because the understanding of Dom is different. IE and Firefox have different processing methods for firstchild and nextsbiling.
So to get to the next node, you can only use type to determine.
Function getnextsibling (startbrother ){
Endbrother = startbrother. nextsibling;
While (endbrother. nodetype! = 1 ){
Endbrother = endbrother. nextsibling;
}
Return endbrother;
}
Function getnextsibling1 (OBJ ){
If (obj. nextsibling. nodetype = 3 ){
Sibling = obj. nextsibling. nextsibling; // Moz. Opera
}
Else {
Sibling = obj. nextsibling; // IE
}
Return sibling;
}
Function getfirstchild (OBJ ){
For (I = 0; I <obj. childnodes. length; I ++ ){
If (obj. childnodes [I]. nodetype = 1)
Return obj. childnodes [I];
Else
Continue;
}
When you need to use it, first getelementbyid gets the first node, and then you can get the following node.
In addition, ie is case-insensitive. html is formatted first, so the ID may be the same.
May cause some problems.
In addition, ie converts null characters into space spaces, which Firefox will not handle,
If null is processed in Javascript, there may be some problems. Opera is basically compatible with IE.
Functions, such as javasnet. All, can be used. However, null characters are not supported. It is a NULL Character in the variable.
Problems may occur.