Note: In HTML Editor version 2009 and higher, the DHTML Menu Builder has been replaced with the CSS Menu Designer, which produces significantly less code that must be placed on your page. To upgrade to the latest version of the HTML Editor, download it from your My Products page. For more information about the CSS Menu Designer, read How to Use the CSS Menu Designer.
You may have noticed that the DHTML Menu Builder produces a lot of code. Putting all that code on your page can slow down load times and make it difficult to work with the rest of the code on your page. Fortunately, there is another option. Rather than pasting the source code for the menu on each page, you can link to an external file that contains that code. The process is similar to linking to an image. Here's what you do:
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:
<script language="javascript" src="yourmenu.js"></script>
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:
<script language="javascript" src="/full/path/to/yourmenu.js"></script>
For more information about absolute and relative linking, read this article: Absolute vs. Relative Paths/Links.
Rate This Article
You must be signed in to rate articles.