|
|
| Cornel Bicutzi 2005-10-11, 6:37 pm |
|
how to alternate row color in css
------------------------------------------------------------------------
Message Posted via: <br />[url=http://www.geekinterview.com/]IT Interview Questions[/url]<br />[url=http://www.geekinterview.com/]IT Tutorials and Articles[/url]<br />[url=http://www.geekinterview.com/]Free IT Trainings[/url]
| |
| Andreas Prilop 2005-10-11, 6:37 pm |
| On Tue, 11 Oct 2005, it was written:
> From: Cornel Bicutzi <>
>
> how to alternate row color in css
>
> Message Posted via: <br />
> [url=http://www.geekinterview.com/]IT Interview Questions[/url]<br />
> [url=http://www.geekinterview.com/]IT Tutorials and Articles[/url]<br />
> [url=http://www.geekinterview.com/]Free IT Trainings[/url]
How to post in Usenet
| |
| Jim Moe 2005-10-11, 6:37 pm |
| Cornel Bicutzi wrote:
> how to alternate row color in css
>
There is no automated way. You can define a class for one color and on
every other row apply that class.
--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
| |
| Beauregard T. Shagnasty 2005-10-11, 6:37 pm |
| Jim Moe wrote:
> Cornel Bicutzi wrote:
> There is no automated way. You can define a class for one color and on
> every other row apply that class.
Well ... there is an automated way, if Cornel uses a server-side script
(PHP, ASP?) to generate his table of data. <g>
$intcnt = 1;
if ($myrow = mysql_fetch_array($result)) {
do {
if ( ($intcnt%2)==0) {
$strbg = "";
} else {
$strbg = "style='background-color: #ffffcc'";
}
printf("<tr>
<td $strbg>$intcnt.</td>
<td $strbg>%s</td>
....
$intcnt++;
} while ($myrow = mysql_fetch_array($result));
}
--
-bts
-When motorcycling, never follow a pig truck
| |
|
|
| Jim Moe 2005-10-12, 3:29 am |
| Beauregard T. Shagnasty wrote:
>
> Well ... there is an automated way, if Cornel uses a server-side script
> (PHP, ASP?) to generate his table of data. <g>
>
But, but, but... I thought the OP wanted a pure CSS way. None of this
fancy schmancy stuff.
--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
| |
| Toby Inkster 2005-10-12, 6:23 am |
| Beauregard T. Shagnasty wrote:
> $intcnt = 1;
> if ($myrow = mysql_fetch_array($result)) {
> do {
> if ( ($intcnt%2)==0) {
> $strbg = "";
> } else {
> $strbg = "style='background-color: #ffffcc'";
> }
> printf("<tr>
> <td $strbg>$intcnt.</td>
> <td $strbg>%s</td>
> ...
> $intcnt++;
> } while ($myrow = mysql_fetch_array($result));
> }
Yuck!
while ($myrow = mysql_fetch_array($result))
{
$style = (!$style)
? ' style="background-color:#ffffcc"'
: ''; # modular arithmetic is for suckers
print "<tr><td{$style}>....</td></tr>\n";
}
// ;-)
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
| |
| Beauregard T. Shagnasty 2005-10-12, 6:27 pm |
| Toby Inkster wrote:
> Beauregard T. Shagnasty wrote:
> [ancient code]
>
> Yuck!
>
> while ($myrow = mysql_fetch_array($result))
> {
> $style = (!$style)
> ? ' style="background-color:#ffffcc"'
> : ''; # modular arithmetic is for suckers
> print "<tr><td{$style}>....</td></tr>\n";
> }
>
> // ;-)
Ok ok ... <g>
--
-bts
-Sucker, who will update old code one day soon
|
|
|
|
| Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |