First, fire up Notepad or another text editor and paste all the DHTML code between the <script>
and <script> tags into a blank document. You should make sure that the only code in the
document is the DHTML code generated by the Menu Builder. This is important. If there is any
other code in the document, your menu will not work.
Once you've pasted the code into the document, save it with the file extension .js . Now you can
use the following code to link it to your page:
Put this code just below your first <body> tag and replace yourmenu.js with the name of your
menu. Also keep in mind that if your menu file is not saved in the same folder as the page that
links to it, this link will not work. In that case, you would have to provide the proper path to the
menu file along with its filename, which might look something like this:
- You can use jQuery'a load() function.
- You can put this on any page you want the nav or footer to duplicate to:
$("#nav") // select nav element on current page
.load("index.html #nav > *"); // grab contents of nav from index page
- Of course, the best way will still be to either put the nav in a file alone and use PHP to
include it on the page or just copy and paste them, in case you have a smaller site.
$("#nav") // select nav element on
.load("index.html #nav > *"); // grab
contents of nav from index page