[LA.pm] alternating...

David Heayn david at cloudgraphics.com
Sat Jun 25 12:34:14 PDT 2005


I'm trying to alternate between printing dark blue rows of an HTML 
table and just blue rows. However, I'm not getting the results I 
want. In fact, I even know why the below code doesn't work. If you 
have any suggestions on how to switch between two colors on table 
rows I would love to hear it.


foreach my $line (@mem)
	{
	if ($color == 0)
		{
		print "<tr><td bgcolor=\"#93c0c0\">";
		$color = 1;
		}
	elsif($color == 1)
		{
		print "<tr><td bgcolor=\"#cae8ff\">";
		$color = 0;
		}

	print "<A HREF=\"$line\">$line</A></TD></TR>\n\n";
	}





btw- This is the meat of what the script prints out:



<tr><td bgcolor="#93c0c0"><A HREF="http://">http://</A></TD></TR>
# this loop went well
<tr><td bgcolor="#cae8ff"><A HREF="http://">http://</A></TD></TR>
# another good one...
<tr><td bgcolor="#93c0c0"><tr><td bgcolor="#cae8ff"><tr><td 
bgcolor="#93c0c0"><A HREF="http://">http://</A></TD></TR>
# problems here... double TR's
<tr><td bgcolor="#cae8ff"><tr><td bgcolor="#93c0c0"><tr><td 
bgcolor="#cae8ff"><tr><td bgcolor="#93c0c0"><tr><td 
bgcolor="#cae8ff"><tr><td bgcolor="#93c0c0"><tr><td 
bgcolor="#cae8ff"><tr><td bgcolor="#93c0c0"><A 
HREF="http://">http://</A></TD></TR>
#lots of problems here... 7 TR tags before getting to what's important.


I hope this is all clear.



David Heayn * http://www.cloudgraphics.com * 213/925.3283


More information about the Losangeles-pm mailing list