PDA

View Full Version : Javascript Navigation Menus



exdox77
12-21-2005, 07:01 PM
I have a website that I have created javascript menus for and I wanted to put the menus in a seperate file so that when it comes time to edit the menu I dont need to edit all of my html files just that one.

I have this code
<SCRIPT LANGUAGE="JAVASCRIPT" SRC="java.js"
TYPE="TEXT/JAVASCRIPT">
</SCRIPT>

to my understanding this is what i would use to refer my menu to the source. but my menu system isnt relizing where the source is, it still thinks it still in the html file itself. my menu
<div id="globalNav">
<a href="#"><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '150px')" onMouseout="delayhidemenu()">12 Volts </a> |
<a href="#"><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu2, '150px')" onMouseout="delayhidemenu()">Audio </a> |
<a href="#"><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu3, '150px')" onMouseout="delayhidemenu()">Security</a> |
<a href="#"><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu4, '150px')" onMouseout="delayhidemenu()">Mobile Theater</a> |
<a href="#"><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu5, '150px')" onMouseout="delayhidemenu()">Remote Starters</a> |
<a href="#"><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu6, '150px')" onMouseout="delayhidemenu()">Performance</a> |
<a href="#"><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu7, '150px')" onMouseout="delayhidemenu()">In-Car Computing</a> |
<a href="#"><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu8, '150px')" onMouseout="delayhidemenu()">Wireless</a> | <a href="forums.html"> Forums</a></div>
</div>

Please some help me, I am planning a big website I if for some reason I need to change my menu I dont want to change all of my pages!

Twey
12-21-2005, 08:01 PM
There should be no problem with this, so long as your Javascript file is named "java.js" and is in the same directory as the webpage. If it's saying that the file cannot be found and/or the functions don't exist, try clearing your browser cache - the page might have got stuck. :)

exdox77
12-22-2005, 07:26 AM
I put the code exactly as it was on the html page itself and then put it in a java file named "java.js" then put that same code for the menu on page then the code on the page should call up "java.js" on demand but it doesnt when i open the page it has errors but when i check for errors dreamweaver says there isnt any! im lost to what i should do.

Twey
12-22-2005, 10:28 AM
Are you sure you put only the Javascript in the file, not the <script></script> tags as well?

exdox77
12-22-2005, 07:20 PM
hey thanks for your help i did of the tags in the file also i removed them and it was fine after that.