making a javascript menus links work

davidjaymz's picture

He has: 193 posts

Joined: Jul 2001

Hi,
I'm using a javascript nav menu and it works fine when i have it in its own folder and all of the html files in the root folder. But I decided that to tidy up the folder I would store the html in seperate folders. EG:
root folder:
JSandCSS (folder)
News (folder) {contains .html files}
some .html files.

Now how do i get the JS menu to go to the right place. I know that originally it just had to send to the root folder so it didn't matter what page you were on. But now if I call news from the root folder it goes to the news page (JS link as news/newspage.html) but if from newspage I go somewhere else it goes to news/news/latestnews.html. which doesn't exist.

I think i need to define absolute address from the root folder. but i'm not sure? does anyone have any ideas or should i go back to having one big folder with lots of .html files in it...

Thanks again

DavidJaymz

They have: 2 posts

Joined: Aug 2001

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If it's an option for you, you can use the third option -- relative to the root urls.

So instead of "news/news.html" you would have "/news/news.html" which tells the browser to ask for the document starting at the root (index.html). The extra forward slash is the key.

Smiling Suzanne

davidjaymz's picture

He has: 193 posts

Joined: Jul 2001

ok
at the moment i'm using the full URL and it seems to be working... just can't surf the site locally...
oh well

DavidJaymz

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.