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


Perkiset's Place Home   Politics @ Perkiset's