function loadXMLDoc(fileName){ var xmlhttp; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200){ return xmlhttp.responseXML; } } xmlhttp.open("GET", fileName, true); xmlhttp.send(); } window.onload = function(){ var xmlDoc = loadXMLDoc("./note.xml"); alert(xmlDoc); }
返回的xmlDoc是undefined,意思是文件读取失败了?文件路径是对的,控制台也没报错,请问问题出在哪?
qq_青枣工作室_0
田心枫