Hi, how would you go about making alternate row colors like on this website??
any ideas??
Regards,
Martin
Gaming Help And Info:
any ideas??
Regards,
Martin
Gaming Help And Info:
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<table>
<?
$color="#FFFFFF";
foreach ($line as $c)) {
if ($color=="#FFFFFF") { // Alternate background color for readability
$color="#CCCCCC";
} else {
$color="#FFFFFF";
}
echo "<tr bgcolor=$color>";
echo "<td>$c</td>";
echo "</tr>
}
?>
</table>
// array for colors.. ("unlimited")
color[0] = "#FFFFFF";
color[1] = "#CCCCCC";
color[2] = "#B5B5FF";
$i = -1; // must be -1, so it will start at 0
echo "<table>";
// switch color
if ($i < count($color)) // if $i is lss than number of colors
{
$i++; // add one to $i
}
else // oops, $i must be the same as number of colors
{
$i = -1; // restart $i
}
echo "<tr bgcolor=\"{$color['$i']}\"><td>test</td></tr>";
echo "</table>";