Changing Background Color

liunx

Guest
Hi Folks<br />
If any one of you know how to change the color of the table row.<br />
I mean if first row has background color grey and then the second recond row has dark grey and it goes on alternatively through out the table. <br />
<br />
Please respond asap<!--content-->what format? cgi, html, or ???<br />
<br />
hanging from a 9th story window<br />
chris<pixelmonkey>:D<!--content-->Try this:<br />
<br />
<br />
<html><br />
<head><br />
<title>Untitled</title><br />
</head><br />
<br />
<body><br />
<table width=100% height=100% cellpadding=0 cellspacing=0 border=0><br />
<tr bgcolor="blue"><br />
<td>&nbsp;</td><br />
</tr><br />
<tr bgcolor="red"><br />
<td>&nbsp;</td><br />
</tr><br />
<tr bgcolor="black"><br />
<td>&nbsp;</td><br />
</tr><br />
<tr bgcolor="#cccccc"><br />
<td>&nbsp;</td><br />
</tr><br />
</table><br />
</body><br />
</html><!--content-->Thanks Dr. Web<br />
I guess I should have made it more clear<br />
I'm pulling data from oracle databse into and and displaying on web in a table format. I need to know if there is any dynamically way of doing it(Changing colors of alternate rows for that table).<br />
And it is an HTMl format<!--content-->i dont know oracle yet.<br />
<br />
sorry i cant help you on this one<br />
chris<pixelmonkey>:D<!--content-->I don't know anything about oracle DB's myself. But maybe this will give you an idea if the scripting is similar to PERL that creates your HTML output. I use a little snippet like this to alternate BG colors in table rows with PERL...<br />
<br />
<br />
$total = 0;<br />
foreach $entry (@LIST) {<br />
$total++;<br />
if ($total =~ /[0,2,4,6,8]$/) {$bgcolor = "#EEEEEE";}<br />
else {$bgcolor = "#CCCCCC";}<br />
$tablerow = $tablerow."<tr bgcolor=$bgcolor><td>your oracle data here</td></tr>\n";<br />
<br />
}<br />
<br />
<br />
then when/where you need to print the output:<br />
<br />
print "$tablerow";<br />
<br />
<br />
Regards,<br />
Kevin<!--content-->Yes, We have also done something similar to this....and we also used some serverside scripting to complete the task. We passed a XML value for the bgcolor of the table cell. It looked something like.....<br />
<tr bgcolor="<$xml.structure.here.whatEverColor>"><br />
<br />
The actual figuring out of the color swap was server side JSP. Just assigning a number for every data row passed. If the row was even, he allotted a bgcolor="white".....and odd bgcolor="grey".<!--content-->Thanks for the response<br />
Anyways i figured it out.I'm using .cfm pages so i can use if then else by checking the modulator of the rowcount.<!--content-->
 
Back
Top