137
rated 0 times
[
140]
[
3]
/ answers: 1 / hits: 39997
/ 11 Years ago, thu, july 4, 2013, 12:00:00
I have a table with this row: (I have six of this in my table)
<tr bgcolor=#FFFFFF id=0>
<td style=height:20px; align=left></td>
<td style=height:20px; align=left></td>
<td style=height:20px; align=left></td>
<td style=height:20px; align=left></td>
</tr>
I want to make a loop that will add innerHTML for each td base on the size of the list. So if there are only two box inside the list, only 2 tr will have inner HTML.
var y = 0;
<%
ArrayList userBoxList = BoxList.getInstance().getUserBoxList();
for(int x=0; x < userBoxList.size(); x++)
{
UserBox box = (UserBox) userBoxList.get(x); %>
document.getElementById(x).onclick = changeColor;
document.getElementById(y).innerHTML = <%=box.getInfo().getBoxNumber()%>;
document.getElementById(y).innerHTML = <%=box.getInfo().getBoxName()%>;
document.getElementById(y).innerHTML = <%=box.getInfo().getBoxOwner()%>;
document.getElementById(y).innerHTML = <%=box.getInfo().getBoxSize()%>;
y++;
<%}%>
More From » html