如何在IE中访问节点类型常量 [英] How does one access the Node Type Constants in IE
问题描述
在所有浏览器中,但IE Node.ELEMENT_NODE被定义。我尝试使用特定的节点实例,例如:
e = $(#element_id)[0];
alert(ELEMENT_NODE:+ ELEMENT_NODE);
这在IE中也不起作用。那么IE的做法是什么呢?我只需要自己定义节点常量?
Internet Explorer 8及更早版本不定义节点类型常量,所以你必须自己定义它们。另外,Internet Explorer 7及更早版本仅适用于支持类型1和3 。
I have a node that I'm note sure is an element (from calling node.previousSibling). However I am having trouble finding out the cross browser javascript way to access the Node constants shown on the MDC.
In all browsers but IE Node.ELEMENT_NODE is defined. I tried using a specific instance of node, e.g.:
e=$("#element_id")[0];
alert("ELEMENT_NODE: " + ELEMENT_NODE);
This does not work in IE either. So whats the IE way to do this? Do I just have to define the node constants myself?
Internet Explorer 8 and earlier don't define the node type constants, so you would have to define them yourself. Additionally, Internet Explorer 7 and earlier only support types 1 and 3.
这篇关于如何在IE中访问节点类型常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!