MikeCou
Technical User
- Apr 23, 2009
- 10
I use a script to run a nav bar. Everything works fine if I have all the files involved in the root folder. When I create subfolders to group same file types and change the script to show the subfolder name in the path, any further selections will show the subfolder path of the previous selection. Here is a snip of the code:
*************
function LoadNav() {
document.write("<div class='navItem2'><a href='./index.html'>Home</a></div>");
document.write("<div class='navItem2'><a href='./meetings.html'>Meetings</a></div>");
document.write( "<ul><li class='folder'>");
document.write( "<div class='navItem2'><div class='expand'><a href='#'>Show 'n Tell</a></div></div>");
document.write( "<ul>");
document.write("<li><a href='./show_tell/0209.html'>February 2009</a></li>");
document.write("<li><a href='./show_tell/0309.html'>March 2009</a></li>");
document.write("<li><a href='./show_tell/0409.html'>April 2009</a></li>");
document.write( "</ul>");
document.write("</li></ul>");
document.write("<div class='navItem2'><a href='./Members.html'>Members Directory</a></div>");
document.write("<div class='navItem2'><a href='./events.html'>Special & Upcoming Events</a></div>");
}
**********************
The first 2 document.writes point to 2 files in the root folder. The next 3 to files in sub-folder "show_tell". The last 2 are files in the root folder as well.
If I select any of the 4 files that are in the root folder (the first 2 or last 2), all goes well and I can jump between the 4 with no problems... until I select 1 of the files in a subfolder such as "./show_tell/0209.html" for example. The first time, I get the page fine. From then on though, any selection I make, whether the file is in a root folder or not, will show a path of "./show_tell/filename.html". If I select another of the files in the show_tell folder, the path will become "./show_tell/show_tell/0309.html". Which of course is wrong.
In summary, once I have selected to view even 1 page which resides in a subfolder, nothing else will work. I have asked around for help and have tried changing the subfolder path name to ./, ../ and just / and then no / at all. Same results except that the only one that will show me at least the first page is ./ and no other.
Right now I am using a work around using the full path names for each file using the url name and all, but this is not very elegant and it's quite time consuming.
Why does the script double up on the path name? And how can I prevent this? (or can I?)
Thanks.
Mike
*************
function LoadNav() {
document.write("<div class='navItem2'><a href='./index.html'>Home</a></div>");
document.write("<div class='navItem2'><a href='./meetings.html'>Meetings</a></div>");
document.write( "<ul><li class='folder'>");
document.write( "<div class='navItem2'><div class='expand'><a href='#'>Show 'n Tell</a></div></div>");
document.write( "<ul>");
document.write("<li><a href='./show_tell/0209.html'>February 2009</a></li>");
document.write("<li><a href='./show_tell/0309.html'>March 2009</a></li>");
document.write("<li><a href='./show_tell/0409.html'>April 2009</a></li>");
document.write( "</ul>");
document.write("</li></ul>");
document.write("<div class='navItem2'><a href='./Members.html'>Members Directory</a></div>");
document.write("<div class='navItem2'><a href='./events.html'>Special & Upcoming Events</a></div>");
}
**********************
The first 2 document.writes point to 2 files in the root folder. The next 3 to files in sub-folder "show_tell". The last 2 are files in the root folder as well.
If I select any of the 4 files that are in the root folder (the first 2 or last 2), all goes well and I can jump between the 4 with no problems... until I select 1 of the files in a subfolder such as "./show_tell/0209.html" for example. The first time, I get the page fine. From then on though, any selection I make, whether the file is in a root folder or not, will show a path of "./show_tell/filename.html". If I select another of the files in the show_tell folder, the path will become "./show_tell/show_tell/0309.html". Which of course is wrong.
In summary, once I have selected to view even 1 page which resides in a subfolder, nothing else will work. I have asked around for help and have tried changing the subfolder path name to ./, ../ and just / and then no / at all. Same results except that the only one that will show me at least the first page is ./ and no other.
Right now I am using a work around using the full path names for each file using the url name and all, but this is not very elegant and it's quite time consuming.
Why does the script double up on the path name? And how can I prevent this? (or can I?)
Thanks.
Mike