|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How do you change the background color of a specific style in a stylesheet? I have a style named "navH" and when the user clicks a link the style changes so all the objects on the page that have that style assigned change. How can I do this?
|
|
#2
|
|||
|
|||
|
Take a look at these examples:
http://www.degs.co.uk/test/styles/cssChange/css.htm & http://www.degs.co.uk/test/styles/c...e/cssChange.htm If so, the Tutorial is here: Dynamic StyleSheets - http://tech.irt.org/articles/js065/ |
|
#3
|
|||
|
|||
|
No that's not really what I need. I'm looking for something more like this:
function changeColors(color) { document.all.navH.background-color=color } Something like that. It will change the style and therefore all the elements with that class. |
|
#4
|
|||
|
|||
|
document.all.### refers to an ID.
A CSS class is not an ID. |
|
#5
|
|||
|
|||
|
So what should I use?
|
|
#6
|
|||
|
|||
|
You can change specific attributes of a declared style class on your page, but it's not as easy as changing the class of individual elements. Here's a hint:
http://www.faqts.com/knowledge_base...id/2147/fid/128 |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > Changing a style with Javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|