Get the parent tag
FF There is no event
using arguments[0]
FF There is no srcElement
Use target
FF There is no parentElement
Use parentNode
function obj_event_onsomething(e){
var e=window. event?window.event:e;
var srcEle=e.srcElement?e.srcElement:e.target;
var theObjectYouWant=srcEle.parentNode;
}
Just now It was also found that the childNodes under FF are larger than those under IE 1
o .previousSibling.href || o.previousSibling.previousSibling.href
The former expression is used under IE, and the latter one is used under FireFox.
Because under IE, XMLDom does not have the preserveWhiteSpace attribute, that is: put the blank space It is also treated as a node, and IE defaults to false, that is, the blank is not regarded as a node.
XMLDom is mentioned here, which seems to be irrelevant to what is mentioned above, but under FireFox, previousSibling is blank. Unless there is no space of any kind between the two HTML tags.
This white space refers to the #text node
The div here should have 5 child nodes
1. From the div mark to the carriage return and line feed before the a mark
2. a mark
3. rn6546rn
4. b mark
5. Carriage return and line feed after b mark and before div end mark