I've created a little dropdown menu with javascript. And I want this on each page of my website. I thought about adding it via iframe but it extends downwards and put a scroll bar in the iframe.

I don't want to copy/paste the dropdown menu to each page because I'll probably change it later, what do you suggest doing.

6 Years
Discussion Span
Last Post by Agarsia

Server side include.

Put the code for the menu in a separate file and include it in each page. When you update that one include file, it will update all pages that have the file included, without having to go update each page manually.

<!--#include file="included.html" -->
<!--#include virtual="/directory/included.html" -->

Learn more at:


Edited by SolidSolutions: n/a


Darn, the server I'm submitting to(old school server) doesn't support these. Is there any way I can do this with JavaScript?


if your script is purely javascript, you can put that script in a .js file (myMenu.js).

Then, include that file where you want the menu like:

<script src="myMenu.js" type="text/javascript"></script>

Just be sure you have the correct path to the src (source) file listed and it should include that .js file in whatever page you want. Then if you want changes, just update your .js file and all the pages change.


No a lot me it is in tables and lists. They just extend using JavaScript. I heard something about interHTML. But how would I load in a file using it.


then create a javascript function that builds up the menu, then include the script in ever page and the function will create everywhere the same menu

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.