Home >Backend Development >XML/RSS Tutorial >Solution to BUG in string and XML conversion under IE
js defines an xml object, var data = "";
JQUERY can convert a string into an XML object, and then use the find() method to node the XML converted from the string operate.
But jQuery cannot parse XML under IE. What is parsed in IE is a text object.
Solution: Determine whether it is an IE browser. If so, re-create and load the xml object
var xml; if ($.browser.msie) {// & parseInt($.browser.version) < 9 alert("这是IE版本是"); xml = new ActiveXObject("Microsoft.XMLDOM"); xml.async = false; xml.loadXML(data); // xml = $(xml).children('nodes'); //这里的nodes为最顶级的节点 } else { xml = data; } alert($(xml).find("DataRow").attr("Id"));
js Define an xml object, var data = "";
JQUERY A string can be converted into an XML object, and then the find() method can be used to perform node operations on the XML converted from the string.
But jQuery cannot parse XML under IE. What is parsed in IE is a text object.
Solution: Determine whether it is an IE browser. If so, recreate the loaded xml object
var xml; if ($.browser.msie) {// & parseInt($.browser.version) < 9 alert("这是IE版本是"); xml = new ActiveXObject("Microsoft.XMLDOM"); xml.async = false; xml.loadXML(data); // xml = $(xml).children('nodes'); //这里的nodes为最顶级的节点 } else { xml = data; } alert($(xml).find("DataRow").attr("Id"));
[Related recommendations]
2. Li Yanhui XHTML Video Tutorial
The above is the detailed content of Solution to BUG in string and XML conversion under IE. For more information, please follow other related articles on the PHP Chinese website!