Dynamic row colors

M

MEM

I have a form where i alternate row color.

Code
================================================================================

var TABLE_ROW_COLOR_ODD = "#CECECE";
var TABLE_ROW_COLOR_EVEN = "#EEEEEE";

function stripeTableRows(tableObject,startRow)
{

var currentRowColor = "";

for (var i = startRow; i < tableObject.rows.length; i++)
{
currentRowColor = TABLE_ROW_COLOR_ODD;

if (i % 2 == 0)
{
currentRowColor = TABLE_ROW_COLOR_EVEN;
}

tableObject.rows.style.backgroundColor = currentRowColor;

}

}

//alternate row colors
function configurePage()
{
stripeTableRows(document.getElementById("table1"),1);
}

body onload="configurePage"
================================================================================

Ok, that works great. I'd like to do add functionality to dynamically
show/hide form rows based a selection criteria made in a drop down
box. The problem i'm having is trying to reset or reorder the row
colors dynamically. Any help would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,052
Latest member
KetoBeez

Latest Threads

Top