PDA

View Full Version : changing an anchor colour through DOM


pthompson2002
09-16-2002, 04:27 PM
I have an anchor tag that is within a Div, eg:

document.getElementById("fscroller").innerHTML='<a href="javascript:showMsg([index]-1)">'+begintag+fcontent[index][0]+closetag+'</a>'

I want to be able to change the colour of the link in a similair way to this:

document.getElementById("fscroller").style.color="rgb(255,255,255)"

But I'm not sure how I can specify it to change the link within the "fscroller" div.

Anyone any ideas?

I know there is aLinkColor and anchor but I'm not sure of the correct order

ShriekForth
09-16-2002, 05:12 PM
You can give the link an id, then just reference that id. This would probably work fine if you are just changing one link.

document.getElementById("fscroller").innerHTML='<a href="java script:showMsg([index]-1)" id=link1>'+begintag+fcontent[index][0]+closetag+'</a>'

Then just get that id.

document.getElementById('link1').style.color = "rgb(0,255,0)";

ShriekForth

pthompson2002
09-17-2002, 08:51 AM
I tried thabut it didn't seem to work.
The contents of the link is changing every 4 seconds, could that be a problem (it is a title in a scroller)