Log in

View Full Version : changing the tr bg color



cTech
09-22-2010, 06:11 PM
I am having problems changing back the tr bg color.

What i am trying to do is:
on click change color
on click again chance color back

this is what i have



<tr height="35px" class="a" id="1" onClick="this.className='b'">

bluewalrus
09-22-2010, 07:12 PM
What are your class codes? I think this maybe a more JS related question.

cTech
09-22-2010, 07:14 PM
i think it could go both ways. then end result is the look of something

bluewalrus
09-22-2010, 08:02 PM
Once the class becomes b you will need to switch it to a when it is clicked again. unless be is a variable but then it would need to be


this.classname= b.value

cTech
09-22-2010, 08:03 PM
My Solution was
<tr height="35px" class="b" onclick="this.className=='a' ? this.className='b' : this.className='a'">

riptide
09-22-2010, 10:47 PM
did that work for you?