js load string as xml
<SCRIPT LANGUAGE="JavaScript">
var x=new ActiveXObject("Microsoft.XMLDOM")
x.loadXML('<html> <body> <div><div>first</div></div> <div>last</div> </body> </html>');
node=x.selectNodes("/html/body/div");
var result = new Array();
for(var i=0; i<node.length; i++)
{
result[i] = "";
for(var k=0; k<node[i].childNodes.length; k++)
{
result[i] += node[i].childNodes[k].xml;
}
}
alert(result);
</SCRIPT>
js load string as xml object
最新推荐文章于 2021-04-08 21:13:10 发布