I posted this in the ColdFusion forum, but I really think it's just a JavaScript question.
Hey all. I have what I think is a very simple request. I have a table where each row is the result of a query. In other words, I never know how many rows are in the query. There is only one <TR> tag. Ok, I'm sure you all are with me so far.
I would like to be able to let my users click anywhere in a row and turn the bgColor of the row to Yellow. I was able to do this, but I would also like them to be able to click the row again to "turn off" the yellow background.
Here is what I've done. The yellow comes up fine, but doesn't go away.
In my <TR> I have:
Which calls this function:
What do you think? Kevin
slanek@ssd.fsi.com
Hey all. I have what I think is a very simple request. I have a table where each row is the result of a query. In other words, I never know how many rows are in the query. There is only one <TR> tag. Ok, I'm sure you all are with me so far.
I would like to be able to let my users click anywhere in a row and turn the bgColor of the row to Yellow. I was able to do this, but I would also like them to be able to click the row again to "turn off" the yellow background.
Here is what I've done. The yellow comes up fine, but doesn't go away.
In my <TR> I have:
Code:
<TR onClick="highlight(this)">
Which calls this function:
Code:
function highlight(row)
{
if (row.bgColor != 'Yellow')
{
row.bgColor = 'Yellow';
}
else
{
row.bgColor = 'White';
}
}
What do you think? Kevin
slanek@ssd.fsi.com