DHTML problem in NN6

by Bryce and Kerri <brycefields(at)royalrodent.com>

 Date:  Fri, 5 Jan 2001 09:03:11 -0800 (PST)
 To:  hwg-basics(at)hwg.org
 Cc:  bryce.fields(at)mail.state.ky.us
  todo: View Thread, Original
HELP!  I am creating dynamic expandable menus for the
Kentucky State Nature Preserves Commission's web site.
 I'm using JavaScript to change the "display" property
to show/hide submenus when a user clicks on a widget. 
Here's the Script:

function toggleMenu(menu, widget1, widget2){ 
	var dom;
	if (document.getElementsByTagName("*")) {
		domMenu = document.getElementById(menu);
		domWidget1 = document.getElementById(widget1);
		domWidget2 = document.getElementById(widget2);
		};
	else {
		domMenu = eval(dom + '.all.' + menu);
		domWidget1 = eval(dom + '.all.' + widget1);
		domWidget2 = eval(dom + '.all.' + widget2);
		};
	if (domMenu.style.display == "none") {
		domMenu.style.display = "block";
		domWidget1.style.display = "none"
		domWidget2.style.display = "inline"
		};
	else {
		domMenu.style.display = "none";
		domWidget1.style.display = "inline";
		domWidget2.style.display = "none";
		};
}

where 'menu' is the menu to be toggled, 'widget1' is a
"+" sign that is displayed while the menu is
collapsed, and 'widget2' is a "-" sign that is
displayed when the menu is open.  Here is a snigglet
of code on how the function is called:

This is the anchor that calls the JavaScript
function... 

<a href="javascript:// "onClick="toggleMenu
'programMenu', 'programwidget1', 'programwidget2')">
<img src="images/widgetplus.gif" id="programwidget1"
style="display: inline; position: relative;">
<img src="images/widgetminus.gif" id="programwidget2"
style="display: none; position: relative;"></a>

and here is the DIV container for the menu that is to
be expanded and collapsed:

<div id="programMenu" style="display: none;">
   //menu items go here		
</div>

Everything works fine in IE5. (I confess I haven't had
a chance to check it in IE4 YET, so I don't know if
the IE4 branch of the JavaScript function works or
not, but I can't see why it wouldn't (famous last
words!).  However NN6, which should have no problem
using the W3C DOM, does not work and I have no idea
why not.  I'm rather new to DHTML.  Am I missing
something obvious?

Incidentally, I realize that NN4 is a DHTML capable
browser and that I've made no attempt to accomadate it
yet in the code.  We're still trying to decide if we
want to support NN4 or recommend to visitors that they
upgrade to 6.

Please CC: all replies to my work address,
bryce.fields(at)mail.state.ky.us.  Any help will be
appreciated.

Bryce Fields
KSNPC Webmaster 

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA