How to create multi-page menu using JavaScript

Website Tips -> Website Multi-Page Menu

When I encountered problems with Method 1, I began to search for another method and I found out that I could develop menu using Javascript and would include it in all the files wherever I wanted it.

I encountered problems with method 2 as well. I read somewhere that search engines do not expand on JavaScripts. When I did View and then Source on my browser top tool bar, I found out that it was exactly the case. The script was called in, but no expansion of the menu.

For your information, this is how I did it in MS Notepad. Maybe you could make it to work for your website. I had to make changes in almost 250 pages to implement it.

The examples I give here are taken directly from my website. Just change the domain name to your own. You could name the script file as menu.js. Make this file name as short as possible, up to 8 characters. The menu.js has the following. Remember this is a bare bone example.

You must have <!- the very first line and //--> as the very last line. You can use comments as shown.

The document.writeln prints out one line. At the end of the line, you must close the line with ');
To go to the next line and have another menu item, have <br> before '); If you look at the font line, at the end of the line, I have <br>. I wanted to start the menu with a blank line.

<!--
<!-- Begin Vertical Menu code -->

document.writeln('<div id="bv_Text1" style="position:absolute;left:38px;top:85px;width:140px;height:423px;background-color:#DFF2F2;z-index:1" align="left">');
document.writeln('<font style="font-size:15px" color="#000000" face="Times New Roman"><br>');

document.writeln('<a href="http://www.mywebsiteworkout.com/index.php">Home</a><br>');
document.writeln('<a href="http://www.mywebsiteworkout.com/about-us.php">About Us</a><br>');
document.writeln('<a href="http://www.mywebsiteworkout.com/contact-us.php">Contact Us</a><br>');
document.writeln('</font></div>');

<!-- End Vertical Menu code -->
//-->

Then, in each of your content file wherever you want your menu inserted, use the following:

<SCRIPT type="text/javascript" src="http://www.mywebsiteworkout.com/menu.js"></SCRIPT>

Again, obviously, you would use your own domain name instead of mine. The name of your menu.js file can remain the same.
Welcome!
A Website Tutorial
Learn to create your first website
Powered By: Voda Utilities

http://www.mywebsiteworkout.com

Navigate
Review
Privacy Policy

About Us
Contact Us
Link To Us


Money Making Discussions


Resources
World News
WebProNews
Content Resources


Our Partners
Rent-A-Coder for less
Boutique Web Designers
Best Web Tools
SEO Book
Web CEO
Money Making Discussions

More Partners
Website Magazine
Job Opportunities
Enjoy WorldWide Brands
Send Flowers
Support this Website

Our Friends
Debt Consolidation