Forum Moderators: open

Message Too Old, No Replies

Javascript to "unlink" certain links depending on URL

Sidenav inserted by ssi; don't want links to current page to link

         

MatthewHSE

4:24 pm on Sep 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

I'm in the middle of designing the first site I've ever done for a client. Naturally I want it to be excellent! :)

Most of the site's navigation will be in a side navigation column. It's a pretty simple site with not much room for expansion, and right now there is probably a maximum of ten links to go in the sidenav.

What I want to do is make the sidenav an ssi, so if necessary I can change it just in the one file. However, I also don't want links to the current page to be links. So, I need to find a javascript that will "unlink" a link based on the current URL, and change it's "look."

For example:

When viewing the homepage, I'd like the "Home" link to not only NOT be a link; I'd also like to have it look a little different. Maybe there would be a way to make it a different CSS class?

Anyway, I think I've rambled enough now that people will be able to understand what I'm after. Does anyone know of something that will do this?

Thanks,

Matthew

korkus2000

5:57 pm on Sep 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think the only way you can do it is to do document.write all the links. This is not a good solution since the page won't be usable be people who have javascript turned off. You could also do some other functions using javascript to set the links, but again you will make it unusable by people without javascript. Not to mention googlebot and all the other spiders you want to use the site.

Do you have any access to server-side scripting?

MatthewHSE

7:02 pm on Sep 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the reply Korkus2000. I hadn't thought about the objections to javascript.

I do have access to server-side scripting, which is another thing I hadn't thought of. Unfortunately I don't have the capability (yet!) to do that kind of scripting.

Of course, if anyone else has some ideas, I'd love to hear them!

Thanks,

Matthew