js读XML,然后往div里加载多张图片。但是for循环只执行一次,出来只有一张图片
<script>if(window.XMLHttpRequest){//codeforIE7+,Firefox,Chrome,Opera,Safarixmlhttp=ne...
<script>
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","config.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
var x=xmlDoc.getElementsByTagName("type");
for(var i = 0; i<x.length; i ++){
document.getElementById("gamerow").innerHTML="<img src="+x[i].getElementsByTagName("imgurl")[0].childNodes[0].nodeValue+"/>";
}
</script>
怎么解决啊 展开
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","config.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
var x=xmlDoc.getElementsByTagName("type");
for(var i = 0; i<x.length; i ++){
document.getElementById("gamerow").innerHTML="<img src="+x[i].getElementsByTagName("imgurl")[0].childNodes[0].nodeValue+"/>";
}
</script>
怎么解决啊 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询