/    Sign up×
Community /Pin to ProfileBookmark

Help with Java Navigation bar

Hi, I want to use the following navigation bar for a new site I’m working on.

[url]http://javascript.internet.com/navigation/multicolmenu.html[/url]

My problem is it requires me to put the menu names in the <head> section. If I do this then I will have to put the menu information in the <head> section of every page on the site. I’d rather not do that in case I need to change the menus later I would not want to have to go through all the pages of my website and change the code in the <head> area.

Anyone know how I can get this to work by maybe putting the <head> code in a css file or something? Any way that I can do this and be able to make changes to my menu without having to change code on every page?

Your help is appreciated. Sorry I’m a rookie so if this is an easy answer I apologize.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@ApekatthjerneJun 04.2007 — Personally, I wouldn't rely on JavaScript to provide the navigation bar. Although JavaScript is wide spread, some users prefer to have it disabled and search engines cannot easily crawl through the pages.

A better alternative is to mark it up in an unordered list and use CSS to provide all the effects that this JavaScript snippet does.

I found this tutorial/example at CSSCreator.com: http://csscreator.com/menu/multimenu.php. It has a little bit of JavaScript which just adds support for older browsers (browsers without the [I]:hover[/I] CSS selector which also include IE6) but search engines can still access the menu through the HTML and users who have JavaScript disabled may still see the full menu if they have good CSS support.

To save JavaScript to a file like a CSS file, just save the script into a file with the extension [B].js[/B]. Link to it using:
&lt;script src="/path/to/javascript.js" type="text/javascript"&gt;&lt;/script&gt;

Although the JavaScript and the CSS can be stored in a centralized file which allows you to make global changes in seconds, the mark-up (the list items) does not. So if we were to alter the menu, even slightly, we'd have to edit every instance on every page. To combat this, we can use server-side scripts to get the menu from a centralized file, similar to the CSS and JavaScript, and include it where we want it. If you don't know these functions, try http://www.boutell.com/newfaq/creating/include.html which has examples of a variety of server-side languages.
Copy linkTweet thisAlerts:
@cmballardauthorJun 04.2007 — Personally, I wouldn't rely on JavaScript to provide the navigation bar. Although JavaScript is wide spread, some users prefer to have it disabled and search engines cannot easily crawl through the pages.

A better alternative is to mark it up in an unordered list and use CSS to provide all the effects that this JavaScript snippet does.

I found this tutorial/example at CSSCreator.com: http://csscreator.com/menu/multimenu.php. It has a little bit of JavaScript which just adds support for older browsers (browsers without the [I]:hover[/I] CSS selector which also include IE6) but search engines can still access the menu through the HTML and users who have JavaScript disabled may still see the full menu if they have good CSS support.

To save JavaScript to a file like a CSS file, just save the script into a file with the extension [B].js[/B]. Link to it using:
&lt;script src="/path/to/javascript.js" type="text/javascript"&gt;&lt;/script&gt;

Although the JavaScript and the CSS can be stored in a centralized file which allows you to make global changes in seconds, the mark-up (the list items) does not. So if we were to alter the menu, even slightly, we'd have to edit every instance on every page. To combat this, we can use server-side scripts to get the menu from a centralized file, similar to the CSS and JavaScript, and include it where we want it. If you don't know these functions, try http://www.boutell.com/newfaq/creating/include.html which has examples of a variety of server-side languages.[/QUOTE]


Thanks! My brother is a Microsoft MVP and he's always cursing java. Now I know why... I like CSS better anyway. And you're right I don't know how to make a centralized file that I could store my navigation in but I'll check out the link. thanks so much
×

Success!

Help @cmballard spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...