Forum Moderators: open

Message Too Old, No Replies

Using document.write for menus

This should be easy, but ...

         

aceholleran

5:23 pm on Sep 15, 2003 (gmt 0)

10+ Year Member



I'm a JS neophyte, and this one should seem simple, but ... I dunno.

I have a site with a couple of simple menus residing in tables. They don't slide, flash, bounce gyrate ... and I don't want them to.

BUT, I want to be able to change them easily, for each appears on about 25 pages.

Is there a way to create an external javascript file (such as, say master.js, and create a function using document.writeln to build my table) and then call it from within the page--without using a handler such as "OnClick"?

Any help (by direct email, too) is appreciated.

Ace in CT

Sinner_G

5:36 pm on Sep 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi aceholleran and welcome to WebmasterWorld.

It seems to me what you are really looking for is a server side include [w3.org].

What you need to do is to write your menu in a separate file, say master.html. Then you only need one line to 'import' it into your page:

<!--#include file="master.html" -->

This is to be placed on each page you want the menu on. Changes then only have to be done in the master.html file.

Purple Martin

1:28 am on Sep 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sinner_G is correct.

Remember, not everyone has JavaScript enabled, and those who don't won't see JavaScript menus. But everyone will see includes.