0
我對XML文件的XML我讀教程(w3schools.com)新我發現樣本閱讀和打印一個XML文件驗證碼:在哪裏我必須把我的XML文件,我想用它在我的動態Web項目在Eclipse上?
<p id="demo"></p>
<script>
var xhttp;
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xhttp.open("GET", "books.xml", true);
xhttp.send();
function myFunction(xml) {
var x, i, txt, xmlDoc;
xmlDoc = xml.responseXML;
txt = "";
x = xmlDoc.getElementsByTagName("title");
for (i = 0; i < x.length; i++) {
txt += x[i].childNodes[0].nodeValue + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}
</script>
</body>
</html>
但我不知道在哪裏,我必須把我的我的動態Web項目上的Eclipse上的XML文件? 代碼上面的指令xhttp.open("GET", "books.xml", true);
我必須把books.xml文件放在哪裏?
謝謝你的代碼中的第二個場景那麼多@Rishal開發辛格 – Micle