I'm making a series of webpages, and need to control top level navigation through an external JS file. I can't even think of how to begin to code this. Does each page need to be assigned an array index? Then how do I hide the link to the current page?

Recommended Answers

All 2 Replies

What do you mean? Are you going to change the navigation menu after the page is loaded?

Or do you just want to know what page was loaded to do something on the contents?

Or do you want to have an tree-like structure that dinamically changes the navigation upon user interaction?

To hide a link to a page is simple, let's hide every link to test.php with jQuery:

$(function() {
    $('a[href="teste.php"]').hide();
});

I forgot to mention, for this part I am not "allowed" to use any libraries. I actually just bit the bullet and made a parallel array for the navigation. Not exactly what was asked of me, but it works. I would suppose I need one array to hold the file addresses and one to keep track of what page is currently displayed. When I tried to do it that way the only way I could get it to work was with absolute file paths, which only help if you're accessing it on my machine. It's turned in now but I would still like to know how it can be done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.