Forum Moderators: open

Message Too Old, No Replies

altering link text?

         

ahmedtheking

10:17 pm on Jul 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to alter the link text of all external links. I have got a script that adds a target="_blank" to all external links, now all I want to do is add a little image.

I've tried this:
document.links[i].innerText=document.links[i].innerText + " <img src=\"/images/builds/2/main/externallinkbg.gif\" alt=\"(External Link)\" title=\"(External Link)\" width=\"15\" height=\"9\" />"

but it doesn't work! Thanks in advance! :D

RonPK

9:02 am on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The innerText property contains only text, i.e. no HTML tags. It also happens to be IE-only. Better try the innerHTML property.

ahmedtheking

10:09 am on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



that worked! thanks :D