Wednesday 26 October 2011

I'm looking for a way to change a website menu in one location and have it automatically change on all pages.

Is there a way with css or any other code to make a website menu in one place so that I don't have to edit the code on all of my pages?I'm looking for a way to change a website menu in one location and have it automatically change on all pages.Use simple external javascript file. That way all you have to do is edit the js file and it will change all the pages that it appears on.



Try this link........there's lots of help on javascript here



http://www.javascript.com/
I'm looking for a way to change a website menu in one location and have it automatically change on all pages.
A good program can do a %26quot;find and replace%26quot; if your menu's source code is the same through all of your pages.



Dreamweaver has this built in.



otherwise, if you use templates, you just make a modification to your template, and all your pages are affected.
I'm looking for a way to change a website menu in one location and have it automatically change on all pages.
You can choose to use frames, but they are cumbersome. A way I recommend is to put this on each page, where you want the menu:



%26lt;script type=%26quot;text/javascript%26quot; src=%26quot;menu.js%26quot;%26gt;%26lt;/script%26gt;



Then make a text file called menu.js that contains this:



document.write(%26quot;%26lt;%26lt;Your menu stuff here%26gt;%26gt;%26quot;);



It works on all browsers, but requires JavaScript to be enabled, so you should probably leave at least one link that isn't dynamically generated.
CSS will not do this. There are a few ways you can make this easy:

* Use a program such as Dreamweaver or GoLive, and put the menu in a template. That way you can update it globally. You can still do all the coding yourself -- just use the program for its template features. This is the approach I use.

* If your Web server supports SSI (server-side includes), you could put the menu in a separate document and include it wherever you want it.

* Instead of SSI, you could use a server-side scripting language such as PHP to include the menu.

* The JavaScript method that another poster described will work, but is risky. Among other things, it means that search engines won't be able to see the links contained in the menus, since they do not generally process JavaScript. This may make it more difficult for them to index your site.