Forum Moderators: open

Message Too Old, No Replies

Highlighting Named Anchors on another page

         

lemetriss

2:40 pm on Nov 7, 2009 (gmt 0)

10+ Year Member



I know a lot of ways of highlighting anchors on the same page with links

but is there any way to highlight anchor link if the destination is on another page?

[edited by: eelixduppy at 5:03 pm (utc) on Nov. 7, 2009]
[edit reason] no URLs, please [/edit]

Fotiman

4:36 pm on Nov 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld!
I assume you mean that if your page is at www.example.com and you have a set of links like this:

<a href="http://www.example.com/">Home</a>
<a href="http://www.example.net/">.NET</a>
<a href="http://www.webmasterworld.com">WebmasterWorld</a>

Then you would like some JavaScript that will style the 2nd and 3rd links differently?

Essentially, you'll need to:
1. Get all of the link elements on the page
2. Compare each href value to see if it matches the current domain
3. If it does not, add a class to the link (like "external")

Then in your CSS you would have whatever styles you wanted defined for the "external" class.