Forum Moderators: open

Message Too Old, No Replies

FrontPage Tips - FP Includes

FrontPage Tips - FP Includes

         

marcomaranao

2:40 pm on Apr 29, 2005 (gmt 0)



Hi there,

I'm using an include page on my web project, and i wanted to have a dynamic menu.

For example:

Menu1
sub 1
sub 2
Menu2
sub 1
sub 2

If the user is in the section of Menu 1, then its sub contents will be shown by calling a javascript function that shows this sub menu. And if i on the section of Menu 2, its sub contents will appear. I am able to achieve this already in ie4+ but it doesn't seem to work in ns4.

It seems to me that i cannot find the objects within an include page.

This is how it is set up

index.html includes [menu.html]
index.html calls a function menu2show(); (works for ie but not in ns4)

Please help.

jimbeetle

3:03 pm on Apr 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi marcomaranao,

Welcome to Webmaster World.

This is probably due to NS4's implementation of the Document Object Model (DOM) more than anything else. The major stumbling block is NS4's use of document.layers as opposed to document.all; this was proprietary to NS, nobody else used it. (If I remember correctly, I believe NS4 also lacked support for 'document.getElementById', but might be wrong on this point.)

Since you mention a "dynamic menu" you're probably going to have to sniff for NS4 and adjust your js code accordingly. There are a few different ways to address this, the simplest being to supply a separate script. There are more elegant solutions around, you're probably going to have to do a bit (a lot) of reading.

Search around for terms like ns4 cross browser dhtml, ns4 dom, netscape javascript, etc. There's a lot of material out there and depending on your menu implementation you should be able to find something that helps.