I have a panel (asp.net) with a CSS class that sets the background color. When I click the panel I want to alternate the background color back and forth between two values.
Then initial bg color in the css:
The only way I can seem to do it is to hard-code the color values in javascript:Code:.panelOpenStyle { background-color: #808080; }
I would like to use these two CSS classes so I wouldn't have to hard code the values in Javascript:Code:if(document.getElementById('panel1').style.backgroundColor == '#808080') document.getElementById('panel1').style.backgroundColor = '#6699CC'; else document.getElementById('panel1').style.backgroundColor = '#808080';
Is there some way for me to alternate between two CSS classes in javascript?Code:.panelOpenStyle { background-color: #808080; } .panelCloseStyle { background-color: #6699cc; }




Reply With Quote