Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Alternating colors for HTML Table's

by hawtin (Prior)
on Sep 06, 2007 at 14:17 UTC ( #637434=note: print w/ replies, xml ) Need Help??


in reply to Alternating colors for HTML Table's

TIMTOWTDI**2

Personally I don't like setting format in the HTML, I find it easier to manage in the stylesheet.

In site.css: .row_2 { background-color: #f4f4f4; } .row_1 { background-color: #ffffff; } In generate.pl: ... print "\@import url(/site.css);\n"; my $num_rowtypes = 2; ... my $count = 0; for(my $i=0;$i<=$#{$items_list};$i++) { print "<tr class=\"row_${count}\">". "<td class=\"pos\">".($i+1)."</td>\n"; foreach my $col ("art","tit","yer","cht") { my $val = link_to($cat,$page,$col,$nam); print "<td class=\"$col\">".$val."</td>\n"; } print "</tr>\n"; $count++; $count = 0 if($count == $num_rowtypes); }


Comment on Re: Alternating colors for HTML Table's
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://637434]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2014-09-23 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (239 votes), past polls