
![]() |
cdc
When a user clicks on link A, I want the color of link B to change.
I figure I can do this with the following code: document.getElementById('B').innerHTML = "<font color=#fff>Anchor Text</font>" But this don't seem right... perkiset
I'd tackle it by changing either the style directly, or by changing the underlying class.
Changing the style directly: document.getElementById('theLinkID').style.color = '#ff0000'; Or, considering you had two different CSS classes named "styleA" and "styleB"... alert(document.getElementById('theLinkID').className); // shows styleA document.getElementById('theLinkID').className = 'styleB'; That orta doya... /p |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads