browser issue causing problem in dropdown feature

Giganews Newsgroups
Subject: browser issue causing problem in dropdown feature
Posted by:  whitney_ca…@amsec.com (Whitney)
Date: 29 Jul 2003

On the left side of the main webpage I have some menu options that
have a drop-down feature that is controlled with javascript. You click
on the main heading and the links for that section show up. Click on
it again and they disappear. This works great in IE6 but doesn't seem
to work in Netscape 7.

I have included the main javascript code below, along with a sample of
the Menu code. What (if anything) do I need to tweak to get this to
work under Netscape?

javascript code:
<script language=JScript>
document.onclick = DropDownMenu;

function DropDownMenu() {
  var LinkClicked, DivName, TargetDiv;

  LinkClicked = window.event.srcElement;
  if (LinkClicked.className == "Category") {
    DivName = "Div_" + LinkClicked.id.substr(5,
LinkClicked.id.length);
    TargetDiv = document.all(DivName);
    if (TargetDiv.style.display == "")
        TargetDiv.style.display = "none";
    else
        TargetDiv.style.display = "";
  } // if
} // DropDownMenu
</script>

Sample of Menu item:
<ul>
<li><b><a id=Link_Memoriam class=Category href=#>In
Memoriam</a></b></li>
<div id=Div_Memoriam style="display:none">
  <ul>
  <li><a href="memoriam/DickPollitz.htm">Dick Pollitz</a></li>
  </ul>
</div>
</ul>

Replies