PDA

View Full Version : Nav bar doesn't work when .js's are in separate directory


thunderwatch
08-31-2002, 05:08 PM
I'm trying to implement the nav bar at:

http://www.dynamicdrive.com/dynamicindex1/topmen3/index.htm

When I put the various *.js files in their own directory, and have them called in the html from a separate directory, the navbar doesn't work.

Does anyone know why this is? It's seems very inefficient to repeat the *.js files in all directories for all html files. It would be better to keep the *.js files in one place, and have the html files call them with a relative or absolute path. For instance:

<script language="javascript1.2" src="../navbarscript/menu.js"></script>

Thank you for your time!

--Thunderwatch

joh6nn
08-31-2002, 09:55 PM
check to make sure that there are no references in the .js files, that depend on having them be in the same directory.

thunderwatch
09-01-2002, 02:51 AM
Thanks -- that was the problem. In one of the .js's there's a variable called "baseHREF". If you put the absolute path to the .js files in that variable and the absolute path to the .js's in the html files, you can store all the .js's in one place, regardless of the directory structure.

Thanks for the input!

--Thunderwatch