Tables
|
|
|
|
<table cellpadding=0 cellspacing=0 border=0 width=100%>
<?
// Define the colours...
$colours = array();
$colours[] = "#EDEDED";
$colours[] = "#CCCCCC";
$colours[] = "#FFFFFF";
// Loop through from 10 -> 15
for ($i = 1; $i <= 15; $i++){
// Print the row with the colour value...
printf("<tr bgcolor="%s"><td>$i</td></tr>n", $colours[0]);
// Now for the magic... First we take the last value off the end of the array
// and pop it onto the beginning...
array_unshift($colours, $colours[count($colours)-1]);
// array_unshift does this nicley, and I've added the "count($colours)-1"
// bit so you can have as many colours as you need...
// Then we remove the last element of the array...
array_pop($colours);
}
?>
</table>
|
|
|
Usage Example
|
|
|
Rate This Script
|
|
|
|