Return to Snippet

Revision: 8112
at September 3, 2008 11:22 by jessnoonyes


Initial Code
This goes in your HTML where you want the menu, or other file, to appear:

<script language="JavaScript" type="text/javascript" 	src="js/menu.js"></script>


Create a new file called "menu.js"


document.write('<ul class="menu">');

// START LINKS //

<!-- Copy and paste to add more links.  Note the first link starts the list, so don't copy that.  -->

document.write('<li>');
document.write('<a href="index.html" class="menu">Home</a>');

document.write('</li><li>');
document.write('<a href="about.html" class="menu">About Us</a>');

document.write('</li><li>');
document.write('<a href="services.html" class="menu">Services</a>');

document.write('</li><li>');
document.write('<a href="gallery.html" class="menu">Photo Gallery</a>');

document.write('</li><li>');
document.write('<a href="testimonials.html" class="menu">Testimonials</a>');

document.write('</li><li>');
document.write('<a href="contact.html" class="menu">Contact Us</a>');

document.write('</li>');

// END LINKS //

document.write('</ul>');

Initial URL

                                

Initial Description

                                

Initial Title
Javascript include menu with external file

Initial Tags
javascript, file

Initial Language
JavaScript