Posted by Ian B on 10/15/87 11:35
What happened there?
Should have read:
ZeldorBlat wrote:
> Try an HTML or CSS newsgroup.
Why? It's a programming problem.
Try this:
<html>
<head>
<title></title>
<style>
td
{
border : solid 1px blue;
}
..oddrow
{
background-color : #FFFFFF;
}
..evenrow
{
background-color : #CCCCCC;
}
#table1
{
border : solid 1px black;
}
</style>
</head>
<body>
<?php
$data = "Example of how to colour alternate lines";
$data .= "<table id='table1'>";
$colour = 0;
for($i=1;$i<26;$i++)
{
$colour = -$colour - 1;
$data .= ($colour)?'<tr class="oddrow">':'<tr class="evenrow">';
$data .= "<td> Line $i </td>";
$data .= "<td> Colour $colour </td>";
$data .= '</tr>';
}
$data .= "</table>";
echo $data;
?>
</body>
</html>
Navigation:
[Reply to this message]
|