Stefan: Navigation funktioniert unter Netscape nicht

hallo,

habe eine navigation für meine page geschrieben. leider funktioniert diese nur im internet explorer, nicht aber im netscape. im netscape können die untermenues nicht geöffnet werden.

was muss ich ändern, definieren, damit meine navigation auch im netscape läuft?

hier mein code zur navigation:

<html> <head>   <style type="text/css">    a {color: #602B39; text-decoration: none;}    body{font-size: 8pt;color: black;font-family: Verdana}   </style> <script language="JavaScript">                 <!--

// Get browser type                 // Object "document.layers" only exists in Netscape Navigator                 if(document.layers)                 {                      ns = 1; ie = 0;                 }                 else                 {                      ns = 0; ie = 1;                 }

// Style Sheet for Netscape Communicator, tree items are positioned absolute.                 // Unlike Internet Explorer, attribute "visibility" is used to show                 // or hide tree items.                 if(ns)                 {                         document.write( "<style type='text/css'>" +                                                                 ".child { position:absolute; visibility:hidden; }" +                                                                 ".parent { position:absolute; visibility:show; }" +                                                         "</style>");                 }

// Style Sheet for Internet Explorer, tree items are positioned relative.                 // Unlike Netscape Communicator, attribute "display" is used to show                 // or hide tree items.                 if(ie)                 {                         document.write( "<style type='text/css'>" +                                                                 ".child { display:none; position:relative; }" +                                                                 ".parent { display:block; position:relative; }" +                                                         "</style>");                 }

//============================================================================                 // function NetscapeInit()                 //                 // Due to the relative positions of the tree items in Netscape Navigator,                 // each position has to be set before the first display.                 //============================================================================                 function NetscapeInit()                 {                         for(var iI=0 ; iI < document.layers.length; iI++)                         {                                 document.layers[iI+1].top = document.layers[iI].y                                 if (document.layers[iI].visibility == "show")                                 {                                         document.layers[iI+1].top += document.layers[iI].clip.height;                                 }                         }                 }

//============================================================================                 // function ExpandShrink()                 //                 // Shows or hides an item in the tree identified by iItem                 //                 // Numeration is as follows:                 //                 // parent(0)                 //   |                 //   +-- child(1)                 // parent(2)                 //   |                 //   +-- child(3)                 // ...                 //============================================================================                 function ExpandShrink(iItem)                 {                         if(ns)                         {                                 if(document.layers[iItem].visibility == "show")                                 {                                         for(var iI=iItem+1; iI<document.layers.length; iI++)                                         {                                                 document.layers[iI].top -= document.layers[iItem].clip.height;                                         }                                         document.layers[iItem].visibility = "hide";                                 }                                 else if(document.layers[iItem].visibility == "hide")                                 {                                         for(var iI=iItem+1; iI<document.layers.length; iI++)                                         {                                                 document.layers[iI].top += document.layers[iItem].clip.height;                                         }                                         document.layers[iItem].visibility = "show";                                 }                         }                         if(ie)                         {     switch (iItem)     {     case 3:     document.all["item"+6].style.display = "none";     document.all["item"+8].style.display = "none";      break;     case 5:     document.all["item"+4].style.display = "none";     document.all["item"+8].style.display = "none";      break;      case 7:     document.all["item"+4].style.display = "none";     document.all["item"+6].style.display = "none";      break;     }

if(document.all["item"+(iItem+1)].style.display == "none" || document.all["item"+(iItem+1)].style.display == "")                                 {                                         document.all["item"+(iItem+1)].style.display = "block";                                 }                                 else if(document.all["item"+(iItem+1)].style.display == "block")                                 {                                         document.all["item"+(iItem+1)].style.display = "none";                                 }                         }                 }

//-->                 </script>

</head>

<body bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0" onLoad="if(ns) NetscapeInit()">   <table width="193" cellpadding="0" cellspacing="0" border="0" background="menubg.jpg">    <tr valign="top">     <td><img src="menutop.jpg" width="193" height="33" border="0" alt="">      <table width="193" cellpadding="15" cellspacing="0" border="0">       <tr valign="top">        <td>        <font face="Verdana"><div id="item1" class="parent">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left">                                                      <a href="Startseite.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'"target="Daten">Home</a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item2" class="parent">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left" valign="center">                                                      <a href="Annette.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">Annette</a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item3" class="parent">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td valign="center">                                                      <a href="javascript:ExpandShrink(3)" target="Navigation" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'">                                                              Stefan                                                      </a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item4" class="child">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left">                                                      <a href="Stefan.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Portrait</a>                                              </td>                                      </tr>          <tr>                                              <td align="left">                                                      <a href="Inline.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Inline</a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item5" class="parent">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td valign="center">                                                      <a href="javascript:ExpandShrink(5)" target="Navigation" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'">                                                              Foto Album                                                      </a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item6" class="child">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left" valign="center">                                                      <a href="1. August 2004/index.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;1. August 2004</a>                                              </td>                                      </tr>                                      <tr>                                              <td align="left" valign="center">                                                      <a href="Zermatt/index.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Zermatt 11.04</a>                                              </td>                                      </tr>                                      <tr>                                              <td align="left" valign="center">                                                      <a href="Lauberhorn/index.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Lauberhorn 05</a>                                              </td>                                      </tr>

<tr>                                              <td align="left">                                                      <a href="mägishütte/index.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Mägishütte 01.05</a>                                              </td>                                      </tr>                                      <tr>                                              <td align="left" valign="center">                                                      <a href="grossetto/index.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Grossetto 03.05</a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item7" class="parent">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left" valign="center">                                                      <a href="javascript:ExpandShrink(7)" target="Navigation" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'">                                                              Wedding                                                      </a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item8" class="child">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left">                                                      <a href="Dates.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Dates</a>                                              </td>                                       </tr>                                       <tr>                                              <td align="left" valign="center">                                                      <a href="Lovestory.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Lovestory</a>                                              </td>                                       </tr>                                       <tr>                                              <td align="left" valign="center">                                                      <a href="Location.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Location</a>                                              </td>                                       </tr>                                       <tr>                                              <td align="left" valign="center">                                                      <a href="Accomodation.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Accomodation</a>                                              </td>                                       </tr>                                       <tr>                                              <td align="left" valign="center">                                                      <a href="Directions.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Directions</a>                                              </td>                                       </tr>                                       <tr>                                              <td align="left" valign="center">                                                      <a href="Witnesses.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Witnesses</a>                                              </td>                                       </tr>                                       <tr>                                              <td align="left" valign="center">                                                      <a href="Wish_liste.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">&nbsp;&nbsp;Wish liste</a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item9" class="parent">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left" valign="center">                                                      <a href="Guestbook.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">Guestbook</a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item10" class="parent">                              <table bor                              der="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left" valign="center">                                                      <a href="Contact.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">Contact</a>                                              </td>                                      </tr>                              </table>                      </div>

<div id="item11" class="parent">                              <table border="0" cellpadding="0" cellspacing="0">                                      <tr>                                              <td align="left" valign="center">                                                      <a href="Link.html" onMouseOver="this.style.font='bold'" onMouseOut="this.style.font='normal'" target="Daten">Link</a>                                              </td>                                      </tr>                              </table>                      </div></font>        </td>       </tr>      </table>     <img src="menubottom.jpg" width="193" height="28" border="0" alt=""></td>    </tr>   </table> </body> </html>

danke für die hilfe. mfg stefan

  1. Hallo,

    habe eine navigation für meine page geschrieben.

    Geschrieben oder doch eher von irgendwo kopiert? ;-)

    if(document.layers)
    [...]
                    else

    Dieses Script stammt aus dem vergangenen Jahrtausend (für NS4 und IE4, die
    heute im Sterben ligen, optimiert) und ist heute nicht mehr brauchbar (bzw. du
    müßtest es komplett umschreiben).

    Benutze das unter keinen Umständen!

    Wenn du in deiner Navigation überhaupt Javascript verwenden willst, solltest
    du schon ganz genau wissen, was du tust (und nicht irgendwo ein gefundenes
    Script einfügen).

    Gruß, Jan

  2. Am besten du schmeißt dein Netscape ganz runter und gehst zum guten alten IE zurück. Er mag vielleicht ein paar kleine Lücken haben, kann dafür aber alles anzeigen und macht keine Spirentien.
    Wenn du ein halbwegs vernünfitiges Sicherheitssystem auf deinem PC hast, sprich Firewall, Antiirenprogramm, Antispywareprogramm etc, dann ist und bleibt er der beste.

    1. Hallo.

      Antiirenprogramm

      Die armen Iren.
      MfG, at