On Aug 16, 2007, at 10:16 AM, Stephan Beal wrote:
This approach might also have an odd side effect due to the stripping of the domain name from window.location: you might end up marking external links as the current page, which would obviously be incorrect. How to generically solve that is left as an exercise for the reader (and if you do it, please post here so i won't have to solve the problem myself ;).
This is good stuff, Stephan. Thanks for sharing. I've done similar contortions to change the color of the current-page's link.
One way to avoid marking external links as the current page would be to begin with an if statement:
if (location.hostname == 'www.mysite.com') { // your code here. } Also, instead of starting out with this:
var loc = ''+window.location; // Be SURE to force a copy, otherwise
you might be able to avoid the next line by using this: var loc = location.pathname; Just some thoughts... --Karl _________________ Karl Swedberg www.englishrules.com www.learningjquery.com