Welcome to WebmasterWorld Guest from 18.205.109.82

Forum Moderators: open

Message Too Old, No Replies

Using document.write for menus

This should be easy, but ...

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

New User

10+ Year Member

joined:Sept 15, 2003
posts:4
votes: 0


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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 27, 2002
posts:959
votes: 0


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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 21, 2002
posts:977
votes: 0


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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members