Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
For loop while和for具有列和行的循环_For Loop_While Loop - Fatal编程技术网

For loop while和for具有列和行的循环

For loop while和for具有列和行的循环,for-loop,while-loop,For Loop,While Loop,我仍然无法通过一段时间和for循环显示项目。我有5项数据,但一行只能容纳3项。我想要实现的是在第1行显示前3项,在第2行显示其余2项。其思想是添加的项目越多,只会增加行数,但每行仅显示3个项目。我昨天得到了帮助,但只是到目前为止。正在寻求更多的帮助。发生的情况是,前3个项目显示在第1行,然后转到下一行,但下一行显示相同的3个项目,而不是项目4和5。我在下面插入代码: <style type="text/css"> #static {width: 221px;padding: 0px

我仍然无法通过一段时间和for循环显示项目。我有5项数据,但一行只能容纳3项。我想要实现的是在第1行显示前3项,在第2行显示其余2项。其思想是添加的项目越多,只会增加行数,但每行仅显示3个项目。我昨天得到了帮助,但只是到目前为止。正在寻求更多的帮助。发生的情况是,前3个项目显示在第1行,然后转到下一行,但下一行显示相同的3个项目,而不是项目4和5。我在下面插入代码:

<style type="text/css">
#static {width: 221px;padding: 0px 4px 0 4px; margin: 6px auto;}

#static .head {font-size: 12px; font-weight:bold; color:#fff; width: 164px; text-align:     center;padding: 2px 15px 4px 15px; margin: 0 0 0 4px; 
    background-image:    url(http://www.hot969boston.com/Pics/bg/nav/img_whiteTransparent.png); background-repeat:    repeat;border-radius:8px; -moz-border-radius:8px; }
#static .head:hover {padding: 2px 15px 4px 15px;  margin: 0 0 0 4px; width: 164px;     text-align: center; 
    background-image: url(http://www.hot969boston.com/Pics/bg/nav/img_blackTrans.png);  background-repeat: repeat;border-radius:8px; -moz-border-radius:8px; }


#static td.HOT969 .image{border: 2px solid #0083cb; text-align: center; padding: 0 0 0  0px; margin: 3px 0 4px 3px;}
#static td.HOT969 .image:hover{border: 2px solid #002156; text-align: center; padding: 0 0 0 0px; margin: 3px 0 4px 3px;}

#static .copy {font-size: 11px; font-weight:normal; color:#fff;margin: 4px 0 0px 0; padding: 0 10px 0 4px;line-height: 14px;}
#static td.HOT969 {background-color: #002156;color: #DFF2FF; font-size:12px; padding: 0 0 0 0px;  }

#static td.HOT969 a:link, #static td.HOT969 a:visited {display: block;border: 2px solid        #0083cb;font-size:16px;color:#FFFFFF;font-weight:bold;text-decoration:none; height:230px;padding: 4px;}


#static td.HOT969 a:hover {display: block;border: 2px solid #002156;background: #0083cb;text-decoration:none;  height:230px;padding: 4px;}


</style>
<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", "/_SHARED/ApplicationData/Public/FlashWriter.aspx?    RotatorGroupID=5357", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
var x = xmlDoc.getElementsByTagName("jpg");

document.write("<table border='0' width='675' cellspacing='0' cellpadding='0'>");
var e = 0;
while (e < x.length) {
document.write("<tr>");

for (i = 0; i < 3; i++) {
e = e + 1;
document.write("<td><table border='0' cellspacing='0' cellpadding='0' id='static' ><tr>    <td class='HOT969'><a href='");
document.write(x[i].attributes.getNamedItem("link").value);
document.write("'><img width='190' height='125' class='image' src='");
document.write(x[i].attributes.getNamedItem("image").value);
document.write("'><br><div class='head'>"); 
document.write(x[i].attributes.getNamedItem("head").value);
document.write("</div><div class='copy'>");
document.write(x[i].attributes.getNamedItem("desc").value);
document.write("</div></a></td></tr></table></td>");
}

document.write("</tr>");

}
document.write("</table>");

</script>

#静态{宽度:221px;填充:0px 4px 0 4px;边距:6px自动;}
#静态。页眉{字体大小:12px;字体重量:粗体;颜色:#fff;宽度:164px;文本对齐:居中;填充:2px 15px 4px 15px;边距:0 4px;
背景图片:url(http://www.hot969boston.com/Pics/bg/nav/img_whiteTransparent.png);背景重复:重复;边框半径:8px;-moz边框半径:8px;}
#头部:悬停{填充:2px15px 4px 15px;边距:04px;宽度:164px;文本对齐:中心;
背景图片:url(http://www.hot969boston.com/Pics/bg/nav/img_blackTrans.png);背景重复:重复;边框半径:8px;-moz边框半径:8px;}
#静态td.HOT969.图像{边框:2px实心#0083cb;文本对齐:居中;填充:0 0px;边距:3px 0 4px 3px;}
#静态td.HOT969.图像:悬停{边框:2px实心#002156;文本对齐:居中;填充:0 0px;边距:3px 0 4px 3px;}
#静态。复制{字体大小:11px;字体重量:正常;颜色:fff;边距:4px 0 0px 0;填充:0 10px 0 4px;行高:14px;}
#静态td.HOT969{背景色:#002156;颜色:#DFF2FF;字体大小:12px;填充:0px;}
#静态td.hot969a:link,#静态td.hot969a:visted{显示:块;边框:2px实心#0083cb;字体大小:16px;颜色:#ffffffff;字体重量:粗体;文本装饰:无;高度:230px;填充:4px;}
#静态td.hot969a:悬停{显示:块;边框:2px实心#002156;背景:#0083cb;文本装饰:无;高度:230px;填充:4px;}
if(window.XMLHttpRequest){//IE7+、Firefox、Chrome、Opera、Safari的代码
xmlhttp=新的XMLHttpRequest();
}
else{//IE6、IE5的代码
xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”);
}
open(“GET”,“/_SHARED/ApplicationData/Public/FlashWriter.aspx?RotatorGroupID=5357”,false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
var x=xmlDoc.getElementsByTagName(“jpg”);
文件。填写(“”);
var e=0;
而(e
hmmmm。。。如果:

 for (i = 0; i < 3; i++) {
     document.write("<td><table border='0' cellspacing='0' cellpadding='0' id='static' ><tr>    <td class='HOT969'><a href='");
     document.write(x[e].attributes.getNamedItem("link").value);
     document.write("'><img width='190' height='125' class='image' src='");
     document.write(x[e].attributes.getNamedItem("image").value);
     document.write("'><br><div class='head'>"); 
     document.write(x[e].attributes.getNamedItem("head").value);
     document.write("</div><div class='copy'>");
     document.write(x[e].attributes.getNamedItem("desc").value);
     document.write("</div></a></td></tr></table></td>");
     e++;
 }
(i=0;i<3;i++)的
{
文件。填写(“”);
e++;
}

通过这种方式,您将使用当前的eth元素

,它没有任何作用。Charlie,有没有其他方法可以实现我想要实现的目标?