Loading My Navbar

liunx

Guest
Is there someway to load my navbar on every page so that when I make a change to the navbar in question, every page will read that (file/thing/whatever) and I don't have to go through all my pages, updating every navbar on it, one by one??:confused:<!--content-->BTW, the NavBar is consisted of a simple table..<!--content-->Does your web host allow you to use SSI, ASP or PHP?<br />
<br />
Find out and report back in this thread.<!--content-->It's crappy geocities. nothing but HTML and Java, basically<!--content-->If you only have that sort of hosting then you can use Javascript to do the job, however there are some limitations.<br />
<br />
<br />
Search engines cannot follow Javascript written links, so instead of having one file you will need two in total.<br />
<br />
<br />
Here is how it works. You create one standard HTML file, called sitemap.htm which every page of your web site has a link to, and which lists every other HTML file on the web site. This is for search engines to spider and index, and for users that are using browsers that do not have javascript enabled.<br />
<br />
<br />
The other file is a Javascript file that every page links to, and which creates your menu bar. This file is simply a series of document.write statements that write the appropriate HTML commands to the page.<br />
<br />
<br />
One or two words of warning. You will need to escape any quotes that are part of the HTML, from those that are a part of the Javascript code, putting a \ before the quotes.<br />
<br />
document.write('<font color=\"#FFFFFF\">')<br />
<br />
<br />
You will also need, to hide, or escape all of the closing tags within the Javascript, so stuff like:<br />
</a> should be written as either '</' + 'a>' or as <\/a> instead:<br />
<br />
document.write('</' + 'font>')<br />
<br />
<br />
This is the line that goes inside every HTML file. It goes in the position where you want the menu to appear:<br />
<br />
<script type="text/javascript" language="Javascript" src=http://www.htmlforums.com/archive/index.php/"/pathname/filename.js"></script><!--content-->ahh.. that's a little more then I think I want to do, but thank you for the helpful information :)<!--content-->It is really simple to do.<br />
<br />
Just make your menu as normal in your usual HTML editor, then copy the code out to a separate text file, and edit it to have document.write(" in front of each line, and ") on the end.<br />
<br />
Then, just fix up the escaping of the HTML quotes, and breaking up any closing tags. It is really simple. Just one Javascript file to do.<br />
<br />
The sitemap is also a doddle. It is just a simple HTML file full of links.<!--content-->
 
Back
Top