Obtain the parent tag
No event under FF
Use arguments [0]
No srcElement under FF
Target
No parentElement under FF
Use parentNode
The Code is as follows:
Function obj_event_onsomething (e ){
Var e = window. event? Window. event: e;
Var srcEle = e. srcElement? E. srcElement: e.tar get;
Var theObjectYouWant = srcEle. parentNode;
}
I just found that the childNodes in FF is 1 larger than that in IE.
The Code is as follows:
O. previussibling. href | o. previousSibling. previousSibling. href
The first expression is used for IE, and the other one is used for FireFox.
In IE, XMLDom does not have the preserveWhiteSpace attribute. That is, blank space is treated as a node, while in IE, the default value is false, that is, blank space is not considered as a node.
XMLDom seems unrelated to the above mentioned, but in FireFox, previussibling is blank unless there is no space between two HTML tags.
This blank refers to # text node
The Code is as follows:
123
6546
321
Here, p should have five subnodes.
1. The carriage return line between p and
2. a mark
3. \ r \ n6546 \ r \ n
4. B mark
5. The carriage return line between Mark B and end p