var xmlDoc = new ActiveXObject( "Microsoft.XMLDOM");
var root;
xmlDoc.async = true;
xmlDoc.onreadystatechange = doit;
xmlDoc.load( "weather.xml"); //加载xml文件
function doit(){
var state = xmlDoc.readyState;
if (state == 4){
var oNodes = xmlDoc.selectNodes( "//Table");//子节点
var texts=oNodes[0].childNodes(0).text;
alert(texts);
javascript 读取xml
最新推荐文章于 2024-08-21 18:07:10 发布