| Row number 0 |
| Row number 1 |
| Row number 2 |
| Row number 3 |
| Row number 4 |
| Row number 5 |
| Row number 6 |
| Row number 7 |
| Row number 8 |
| Row number 9 |
Here is the code for it:
function useColor()
{
//remember the last color we used
static $ColorValue = "#00FF00";
//choose the next color
if($ColorValue == "#00FF00")
{
$ColorValue = "#CCFFCC";
}
else
{
$ColorValue = "#00FF00";
}
return($ColorValue);
}
print("<table width=\"300\">\n");
for($count=0; $count < 10; $count++)
{
//get color for this row
$RowColor = useColor();
/*
** print out HTML for row
** set background color
*/
print("<tr>" .
"<td style=\"background: $RowColor\">" .
"Row number $count" .
"</td>" .
"</tr>\n");
}
print("</table>\n");