私はというドキュメントに次のxmlコードがありますnote.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
そして私はsample.htmlと呼ばれるファイルに次のhtmlコードを持っています
<!DOCTYPE html>
<html>
<body>
<h1>W3Schools Internal Note</h1>
<div>
<b>To:</b> <span id="to"></span><br />
<b>From:</b> <span id="from"></span><br />
<b>Message:</b> <span id="message"></span>
</div>
<script type="text/javascript">
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","C:\Users\cxpv2\Desktop\IV\New folder\Test Game descriptions\attempt test game1\note.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.getElementById("to").innerHTML=
xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue;
document.getElementById("from").innerHTML=
xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue;
document.getElementById("message").innerHTML=
xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue;
</script>
</body>
</html>
この例は、w3schools.comから直接取得したものです。上記のxmlのノード値は、htmlドキュメントに表示されていません。htmlファイルの名前を変更するか、これがhtmlファイルのxmlコンテンツを表示する正しい方法であるかどうかを知らせてください。
私は変更しました
xmlhttp.open("GET","note.xml",false);
に
xmlhttp.open("GET","C:\Users\cxpv2\Desktop\IV\New folder\Test Game descriptions\attempt test game1\note.xml",false);
正確な場所全体に言及する
アップデート
iamが少なくともそれを正しくやっているかどうか教えてください。activexobjectに問題があるかどうかをシステム管理者に尋ねます