也许问题在于我错误地编写了文件路径,我正在使用Linux,我需要以不同的方式编写路径吗?
<script type="text/javascript">
function func(){
var xmlFile = new XMLHttpRequest();
xmlFile.open("GET", "/home/kat/course/data.xml", false);
xmlFile.send();
xmlDoc = xmlFile.responseXML;
document.getElementById("result_field").value = xmlDoc;
}
</script>
localhost
,127.0.0.1
?) - Hatchetresult_field
标签是输入框或文本框,否则您将无法看到结果。 - Lewis/kat
? - epascarello