<sc*****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
i have a foreach loop in my HTML code which takes a java variable and
for each instance of that variable generates a tr within my table. now
if i hardcode the background for the tr it happens to every single row.
i want to alternate the row colours so that the table rows are a lot
more easier to read. hope this clarifies my question.
Almost anything can be fixed with an if statement.
Use a string variable to hold the color.
And before you use it in the tr tag, have an if statement something like
this
if (theColor.equals("red")){
theColor = "blue";
}else{
theColor = "red";
}
theString = "<tr style='background-color:" + theColor + "'>";
----or something along those lines ----
BTW this is a javascript group - and javascript is not java