in reply to Odd and even table rows
Not necessarily overkill in as that's pretty much what any such scheme is going to boil down to underneath; however it's certainly more verbose than it needs to be.
my $ctr = 0; my $class; while( $pointer = $sth->fetchrow_hashref ) { $class = ( ($ctr++) % 2 == 0 ) ? "even" : "odd"; ## ... }
Alternately there are JavaScript libraries which will go in and post-facto class-er-ize tables dynamically (which is nice if you're doing some Ajax fanciness and possibly reordering rows on the fly).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Odd and even table rows
by GrandFather (Saint) on Aug 08, 2007 at 12:59 UTC |