In a loop, I need to generate a random number and convert it to a random color. Then, using the generated color, change the background color of the cell. Iterate 10 times and change the colors from the leftmost cell to the rightmost cell. Problem is im not sure how to do this. The following is my code to generate the table i need. I'm not sure this could work because how can i access an individual cell without using id?
<table>
<tr>
<script type="text/javascript">
var rownum = 1; var colnum = 1;
while (rownum <= 1){
document.write("<tr>");
while (colnum <= 10) {
document.write("<td>"+colnum+"</td>");
colnum++;
}
document.write("</tr>");
colnum = 1; rownum++;
}