悬赏园豆:15
[已解决问题]
解决于 2008-08-25 15:58
<P><script type="text/javascript"><BR> var index=0;<BR> var xmlHttp;<BR> function createXMLHttpRequest() { <BR> if (window.ActiveXObject) { <BR> xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); <BR> } <BR> else if (window.XMLHttpRequest) { <BR> xmlHttp = new XMLHttpRequest(); <BR> } <BR>} <BR>function getimg() { <BR> //{"make":"Dodge","model":"Coronet R/T","year":1968,"color":"yellow"} <BR> <BR> var url = "puzzle_do.jsp" ; <BR> createXMLHttpRequest(); <BR> xmlHttp.open("POST", url, true); <BR> xmlHttp.onreadystatechange = handleStateChange; <BR> //xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;"); //is needed when post <BR> xmlHttp.send(); <BR>} <BR>function handleStateChange() { <BR> if(xmlHttp.readyState == 4) { <BR> if(xmlHttp.status == 200) { <BR> //window.setTimeout(getimg,1000); <BR> var srcs=xmlHttp.responseText;<BR> var src=srcs.substring(6,srcs.length);<BR> <FONT color=#ff6600> fillimg();<BR></FONT> } <BR> } <BR>} </P>
<P> <BR> function fillimg(){<BR> <BR> var srcs="F:/1_1.jpg,F:/1_2.jpg,F:/1_3.jpg,F:/2_1.jpg,F:/2_2.jpg,F:/2_3.jpg,F:/3_1.jpg,F:/3_2.jpg,F:/3_3.jpg,#";<BR> var src=srcs; <BR> var list =src.split(','); <BR> alert(list[0] ); <BR> document.write("<table>");<BR> alter("write");<BR> for (var r=0;r<4;r++)<BR> {<BR> alert("for1start");<BR> document.write("<tr>");<BR> if(r<3)<BR> {<BR> for (var d=0;d<3;d++)<BR> {<BR> alert("for2start");<BR> if(list[index]!=null&&list[index]!=""&&list[index]!="&nbsp;")<BR> {<BR> alert(list[index]);<BR> document.write("<td><img src='"+list[index] + "' alt='' width=70px height=70px/></td>");<BR> index++;<BR> }<BR> else<BR> {<BR> alert(list[index]);<BR> document.write("<td><img src='"+list[index] + "' alt='' width=70px height=70px/></td>");<BR> }<BR> }<BR> document.write("</tr>"); <BR> }<BR> else<BR> {<BR> //alter(list[index]);<BR> document.write("<td><img src='F:/kongbai.bmp' alt='' width=70px height=70px/></td>");<BR> document.write("</tr>");<BR> alert(index);<BR> alert(list[index]);<BR> }<BR> {<BR> <BR> document.write("</tr>"); <BR> }<BR> }<BR> document.write("<tr><td colspan='3'><img name='img_sure' src='C:/Documents and Settings/dgtdg/My Documents/My Pictures/091715_1681792287_qqodzhdb.jpg' height='210px' width='210px'/></td></tr>");<BR> document.write("</table>");</P>
<P> }<BR></script></P>
<P> 如果在红色标记处调用fillimg()会导致fillimg()中的document.write不执行,但是如果单独调用fillimg() document.write就好用这是为什么啊</P>