Helmut Kuhn: geht nicht mit Netscape 6.2

Hallo Leute.

Mein Mißgeschick ist, dass eine Seite meiner Homepage mit MSIE klappt, aber nicht mit Netscape 6.2

.js
<!--
//Triathlon 2 Dimensional
var y1  = 0;
var y2  = 400;
var x  = 0;
var schritt = 1;
var a  = 0;

whatbrowser();
 sety();

function sety()
 {
  if(y1 >= 0 || y1 < 400)
  {
   if(ie)
   {
    document.all["schw"].style.posTop = y1;
   }
   if(ns)
   {
    document.layers["schw"].top = y1;
   }
   y1 += schritt;
   window.status = 'Schwimmen:'+y1+' Radfahren:'+x+' Laufen:'+a;
  }
  if(y1 < 0 || y1 >= 400)
  {
   y1 = -100;
   if(ie)
   {
    document.all["bike"].style.left = x;
   }
   if(ns)
   {
    document.layers["bike"].left = x;
   }
   x += schritt;
   window.status = 'Schwimmen:ok Radfahren:'+x+' Laufen:'+a;
  }
  if(x < 0 || x >= 500)
  {
   x = -100;
   if(ie)
   {
    document.all["jogg"].style.posTop = y2;
   }
   if(ns)
   {
    document.layers["jogg"].top = y2;
   }
   y2 -= schritt;
   if(y2 > 0)
   {
    a++;
    window.status = 'Schwimmen:ok Radfahren:ok Laufen:'+a;
   }
  }
  if(y2 <= 0)
  {
   window.status = 'Schwimmen:ok Radfahren:ok Laufen:ok !!Finisher!!';
  }
 }
 setInterval("sety()",10);
 function whatbrowser()
 {
  ns = (document.layers || navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 5)?true:false;
  ie = (document.all)?true:false;
 }
//-->

.htm

<html>
<head>
<title>Triathlon</title>
<LINK REL="Stylesheet" TYPE="text/css" HREF="css/triathlon.css">
</head>
<body>
<div id="schw"><img src="images/schw.jpg" width="28" height="100" title="Triathlon"></div>
<div id="bike"><img src="images/biker_1.jpg" width="60" height="66" title="Triathlon"></div>
<div id="jogg"><img src="images/jogg.gif" width="107" height="63" title="Triathlon"></div>
<script language="JavaScript" src="js/sety.js">
</script>
 <table align="center">
  <tr><h2>Triathlon&#058; Links</h2>
  </tr>
       </table>
 </body>
</html>

.css

<!--
h2
  {
   color:   #FFFFFF;
   font-size:  15px;
   padding:  3px;
   font-family:  Tahoma,Arial,Helvetica;
   font-weight:  700;
   text-decoration: none;
  }
a
  {
   color:   yellow;
   font-family:  Tahoma,Arial,Helvetica;
   font-size:  10px;
   text-decoration: underlined;
  }
body
  {
   background-color: #203080;
  }
font
  {
   font-color:  #FFFFFF;
  }
table
  {
   font-color:  #FFFFFF;
   color:   #FFFFFF;
  }
#bike
  {
   position:  absolute;
   top:   400;
   left:   0;
   z-index:  3;
  }
#schw
  {
   position:  absolute;
   top:   0;
   left:   0;
   z-index:  3;
  }
#jogg
  {
   position:  absolute;
   top:   403;
   left:   500;
   z-index:  3;
  }

-->

Was mache denn ich falsch?

  1. Halihallo

    Mein Mißgeschick ist, dass eine Seite meiner Homepage mit MSIE klappt, aber nicht mit Netscape 6.2

    [...]

    Was mache denn ich falsch?

    Netscape 6.2 unterstützt weder Layer, noch document.all... Beim NS 6.2 muss mit <div>'s gearbeitet werden

    Viele Grüsse

    Philipp

    1. Hallo Philipp.

      Erstmal Danke für Deine Mühe mir zu Helfen!

      Netscape 6.2 unterstützt weder Layer, noch document.all... Beim NS 6.2 muss mit <div>'s gearbeitet werden

      Wenn Netscape 6.2 nicht mit Layer, noch document.all.. arbeitet, mit was dann?
      Ich arbeite mit div Container Tags, siehe .htm

      Gruß.
      Helmut

  2. hi

    da sind so einige Fehler... Der einfachheit halber bau ich den IE-Code mal um, solange man keinen IE4 mehr braucht reicht das...

    document.all["schw"].style.posTop = y1;

    document.getElementById("schw").style.top = y1 + "px";

    document.all["bike"].style.left = x;

    document.getElementById("bike").style.left = x + "px";

    document.all["jogg"].style.posTop = y2;

    document.getElementById("jogg").style.top = y2 + "px";

    ns = (document.layers || navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 5)?true:false;
      ie = (document.all)?true:false;

    ns = (document.layers)?true:false;
    ie = (document.GetElementById)?true?false;

    #bike
      {
       position:  absolute;
       top:   400;
       left:   0;
       z-index:  3;
      }

    top: 400px;

    #jogg
      {
       position:  absolute;
       top:   403;
       left:   500;
       z-index:  3;
      }

    top:403px;
    left:500px;

    Was mache denn ich falsch?

    du hast/hattest kein W3C-Kompatibles DHTML da drin, sondern nur alten Kram.

    Grüße aus Bleckede

    Kai

    1. Hallo Kai

      Erstmal Danke für Deine Mühe mir zu Helfen!

      Mein Code ist geändert, aber meine Grafiken bewegen sich nur mit dem MSIE. Unter dem Netscape 6.2 tut sich nichts, die Grafiken bleiben an Ihrer .css Position stehen. Ich vermute, da fehlt noch etwas bei if(ns) ..

      geändeter Code

      .js
      <!--
      //Triathlon 2 Dimensional
      var y1  = 0;
      var y2  = 400;
      var x  = 0;
      var schritt = 1;
      var a  = 0;

      whatbrowser();
       sety();

      function sety()
       {
        if(y1 >= 0 || y1 < 400)
        {
         if(ie)
         {
          document.all["schw"].style.posTop = y1;
          document.getElementById("schw").style.top = y1 + "px";
         }
         if(ns)
         {
          document.layers["schw"].top = y1;
         }
         y1 += schritt;
         window.status = 'Schwimmen:'+y1+' Radfahren:'+x+' Laufen:'+a;
        }
        if(y1 < 0 || y1 >= 400)
        {
         y1 = -100;
         if(ie)
         {
          document.all["bike"].style.left = x;
          document.getElementById("bike").style.left = x + "px";
         }
         if(ns)
         {
          document.layers["bike"].left = x;
         }
         x += schritt;
         window.status = 'Schwimmen:ok Radfahren:'+x+' Laufen:'+a;
        }
        if(x < 0 || x >= 500)
        {
         x = -100;
         if(ie)
         {
          document.all["jogg"].style.posTop = y2;
          document.getElementById("jogg").style.top = y2 + "px";
         }
         if(ns)
         {
          document.layers["jogg"].top = y2;
         }
         y2 -= schritt;
         if(y2 > 0)
         {
          a++;
          window.status = 'Schwimmen:ok Radfahren:ok Laufen:'+a;
         }
        }
        if(y2 <= 0)
        {
         window.status = 'Schwimmen:ok Radfahren:ok Laufen:ok !!Finisher!!';
        }
       }
       setInterval("sety()",10);
       function whatbrowser()
       {
        ns = (document.layers || navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 5)?true:false;
        ie = (document.all)?true:false;
        ns = (document.layers)?true:false;
        ie = (document.GetElementById)?true?false;
       }
      //-->

      .css
      <!--
      h2
        {
         color:   #FFFFFF;
         font-size:  15px;
         padding:  3px;
         font-family:  Tahoma,Arial,Helvetica;
         font-weight:  700;
         text-decoration: none;
        }
      a
        {
         color:   yellow;
         font-family:  Tahoma,Arial,Helvetica;
         font-size:  10px;
         text-decoration: underlined;
        }
      body
        {
         background-color: #203080;
        }
      font
        {
         font-color:  #FFFFFF;
        }
      table
        {
         font-color:  #FFFFFF;
         color:   #FFFFFF;
        }
      #bike
        {
         position:  absolute;
         top:   400px;
         left:   0;
         z-index:  3;
        }
      #schw
        {
         position:  absolute;
         top:   0;
         left:   0;
         z-index:  3;
        }
      #jogg
        {
         position:  absolute;
         top:   403px;
         left:   500px;
         z-index:  3;
        }

      -->

      1. Hi!

        Mein Code ist geändert, aber meine Grafiken bewegen sich nur mit dem MSIE. Unter dem Netscape 6.2 tut sich nichts, die Grafiken bleiben an Ihrer .css Position stehen. Ich vermute, da fehlt noch etwas bei if(ns) ..

        Probelem:

        if(ie)            <----------Falsche Browserabfrage!
           {
            document.all["schw"].style.posTop = y1;
            document.getElementById("schw").style.top = y1 + "px";
           }
           if(ns)
           {
            document.layers["schw"].top = y1;
           }

        Du hast document.getElementById in eine Falsche Browserweiche gepackt, welche vermutlich nur im IE aktiviert wird.
        Du solltest deine Browserweiche auf jeden Fall ändern und DOMorientiert ausgestallten!

        zB:

        W3C-kompatible Browser (IE>=5,Netsacape>=6/Mozilla,Konqueror>=2):
        w3c = document.getElementById ? 1 : 0;
        ie4:
        ie4 = (document.getElementById && !w3c) ? 1 : 0;
        NN4.xx
        nn4 = document.layers ? 1 : 0;

        Und jetzt deine Funktionen neu sortieren!

        Gruß Herbalizer

      2. hi

        Mein Code ist geändert, aber meine Grafiken bewegen sich nur mit dem MSIE. Unter dem Netscape 6.2 tut sich nichts, die Grafiken bleiben an Ihrer .css Position stehen. Ich vermute, da fehlt noch etwas bei if(ns) ..

        schmeinß die Zeilen mit document.all _ersatzlos_ raus. Die Variable "ie" steht dann für Browser, die DOM können (wie es eben der IE ab version 5 tut oder Netscape 6)

        function whatbrowser()
         {
          ns = (document.layers)?true:false;
          ie = (document.GetElementById)?true?false;
         }

        so sieht dann die Abfrage aus. Für Netscape 6 wird dann die Variable aif "ie" gesetzt, wie übrigens von jedem aktuellen Browser - nur Netscape 4 nicht (der kennt nur und als einziger document.layers).

        Grüße aus Bleckede

        Kai