gustav: das Script funktioniert nur mit IE und nicht mit Mozilla :o(

Hallo,

ich habe das Problem, daß das folgende Script mit InternetExplorer funktioniert, aber mit Mozilla nicht:

<SCRIPT language=JavaScript>
var showbox = "1";

if (showbox) {
 var ende = false;
 var pop;

function MMSetup() {
  pop = document.all.popup.style;
  document.onmousemove = MovePopup;
  MovePopup();
 }

function MovePopup() {
  if (!ende) {
   pop.top = document.body.scrollTop-30;
   pop.height = document.body.offsetHeight+30;
  }
 }

function pms_close() {

ende = true;
  pop.visibility = "hidden";
 }

window.onscroll = MovePopup;
}
</SCRIPT>

Es wäre nett, wenn jemand mir weiterhelfen könnte.

Danke im Voraus.

Gruß
G.M.

  1. nunja ganz einfach. das "all"-object ist genauso wie die eigenschaft "offsetHeight" nur im ie verfügbar. eine ms-erfindung.

    arbeite statt dem "all" mit "getElementById" und die höhe kannst du über das object "style.height" abfragen bzw. ändern.

    gruß hein

    1. Hi,

      arbeite statt dem "all" mit "getElementById" und die höhe kannst du über das object "style.height" abfragen bzw. ändern.

      wenn ich aber statt "all" "getElementById" benutze funktioniert es nicht.

      Gruß
      G.M.

      1. nee ja - nicht einfach das wort ersetzen! das ist eine andere methode auf elemente im einem dokument zuzugreifen. zur nutzung solltest dir vollgendes ansehen: http://selfhtml.teamone.de/javascript/objekte/document.htm#get_element_by_id - dann hast du gleich den lerneffekt für künftige scripts. wenn du bei der umsetzung dann noch probleme hast, poste deinen code erneut.

        nur mut ;-)

        gruß hein

        1. wenn du bei der umsetzung dann noch probleme hast, poste deinen code erneut.

          <html>
          <head>

          <SCRIPT language=JavaScript>
          var showbox = "1";

          if (showbox) {
           var ende = false;
           var pop;

          function MMSetup() {
            pop = document.all.popup.style;
            document.onmousemove = MovePopup;
            MovePopup();
           }

          function MovePopup() {
            if (!ende) {
             pop.top = document.body.scrollTop-30;
             pop.height = document.body.offsetHeight+30;
            }
           }

          function pms_close() {

          ende = true;
            pop.visibility = "hidden";
           }

          window.onscroll = MovePopup;
          }
          </SCRIPT>
          </head>

          <body topmargin="0" leftmargin="0" onload="winopen()">
          <DIV id=popup style="LEFT: 0px; POSITION: absolute; TOP: -150px; HEIGHT: 0px"
          width="100%">

          <TABLE height="100%" width="100%">
            <TBODY>
            <TR>
              <TD align=middle>
                <TABLE cellSpacing=1 cellPadding=4 width=400>
                  <TBODY>
                  <TR>
                    <TD>Hallo Leute</TD></TR>
                  <TR>

          <TD><br><center>Herzlichen Wilkommen !</center>

          <BR><BR>
                      <TABLE cellSpacing=0 cellPadding=0>
                        <TBODY>
                        <TR>
                         </TR></TBODY></TABLE>
                      <TABLE width="100%">
                        <TBODY>
                        <TR>
                          <TD align=middle width="50%">
                            <TABLE cellSpacing=1 cellPadding=3 width=150
                              bgColor=#555555><TBODY>
                              <TR id=title bgColor=#DBDBDB>

          <TD align=middle><A href="Seite1.php>Ja</A>
                                </TD></TR></TBODY></TABLE></TD>
                          <TD align=middle width="50%">
                            <TABLE cellSpacing=1 cellPadding=3 width=150
                              bgColor=#555555><TBODY>
                              <TR id=title bgColor=#DBDBDB>
                                <TD align=middle><A href="javascript:pms_close()">Schließen</A></B></FONT>
                                </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>
          <SCRIPT language=JavaScript>MMSetup();</SCRIPT>

          irgendwie komme ich leider nicht weiter.

          Danke im Voraus.

          Gruß
          G.M.

          1. .. na aber du hast doch das "all" und "offsetheight" gar nicht ersetzt?! ich meinte mit code-posten, erst selbst probieren dann nachfragen.

            nutze bitte den link, den ich dir vorhin gegeben habe und lies dir die paar sätze zur verwendung von getElementById durch. ändere deinen code entsprechend (vorher backup machen!) und schau, ob es funktioniert. wenn nicht, melde dich hier nochmal mit deinem neuen code.

            das wird schon!

            gruß hein

            1. Finde sehr nett, adß Du mir dabei hilfst.

              <html>
              <head>

              <SCRIPT language=JavaScript>
              var showbox = "1";

              if (showbox) {
               var ende = false;
               var pop;

              function MMSetup() {
                pop = document.getElementById("fenster").popup.style;
                document.onmousemove = MovePopup;
                MovePopup();
               }

              function MovePopup() {
                if (!ende) {
                 pop.top = document.body.scrollTop-30;
                 pop.height = document.body.style.height+30;
                }
               }

              function pms_close() {

              ende = true;
                pop.visibility = "hidden";
               }

              window.onscroll = MovePopup;
              }
              </SCRIPT>
              </head>

              <body topmargin="0" leftmargin="0" onload="winopen()">
              <DIV id=popup style="LEFT: 0px; POSITION: absolute; TOP: -150px; HEIGHT: 0px"
              width="100%">

              <TABLE id="fenster" height="100%" width="100%">
                <TBODY>
                <TR>
                  <TD align=middle>
                    <TABLE cellSpacing=1 cellPadding=4 width=400>
                      <TBODY>
                      <TR>
                        <TD>Hallo Leute</TD></TR>
                      <TR>

              <TD><br><center>Herzlichen Wilkommen !</center>

              <BR><BR>
                          <TABLE cellSpacing=0 cellPadding=0>
                            <TBODY>
                            <TR>
                             </TR></TBODY></TABLE>
                          <TABLE width="100%">
                            <TBODY>
                            <TR>
                              <TD align=middle width="50%">
                                <TABLE cellSpacing=1 cellPadding=3 width=150
                                  bgColor=#555555><TBODY>
                                  <TR id=title bgColor=#DBDBDB>

              <TD align=middle><A href="Seite1.php>Ja</A>
                                    </TD></TR></TBODY></TABLE></TD>
                              <TD align=middle width="50%">
                                <TABLE cellSpacing=1 cellPadding=3 width=150
                                  bgColor=#555555><TBODY>
                                  <TR id=title bgColor=#DBDBDB>
                                    <TD align=middle><A href="javascript:pms_close()">Schließen</A></B></FONT>
                                    </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>
              <SCRIPT language=JavaScript>MMSetup();</SCRIPT>

              Gruß
              G.M.

              1. ok, wunderbar - du hast es versucht. vom prinzip her ist nicht mehr viel zu ändern gewesen. ich habe an entpr. stellen einen kommentar gepackt. in meinem mozilla 1.5 läuft das jetzt genauso wie im ie, gib mal bescheid wie es bei dir aussieht ...

                <html>
                <head>

                <script language=javascript>

                var showbox = "1";

                if (showbox) {
                  var ende = false;
                  var pop;

                function MMSetup() {

                /* du greifst auf das div "popup" zu, nicht auf "fenster" */
                    pop = document.getElementById("popup").style;
                    document.onmousemove = MovePopup;
                    MovePopup();
                  }

                function MovePopup() {
                    if (!ende) {
                      pop.top = document.body.scrollTop-30;
                      pop.height = document.body.style.height+30;
                    }
                  }

                function pms_close() {
                    ende = true;
                    pop.visibility = "hidden";
                  }

                window.onscroll = MovePopup;
                }
                </script>
                </head>

                <!-- diese winopen()-funktion öffnet noch etwas anderes, oder? für
                dieses script ist sie wohl nicht nötig -->
                <body topmargin="0" leftmargin="0" onload="winopen()">

                <div id="popup" style="left: 0px; position: absolute; top: -150px; height: 0px" width="100%">

                <!-- tabelle benötgt keine id, liegt ja im <div>-container "popup" -->
                <table height="100%" width="100%">
                  <tbody>
                  <tr>
                    <td align=middle>
                      <table cellspacing=1 cellpadding=4 width=400>
                      <tbody>
                        <tr>
                          <td>Hallo Leute</td>
                        </tr>
                 <tr>
                          <td><br><center>Herzlichen Wilkommen !</center><br><br>
                            <!-- kommt hier noch was rein? sonst kann die doch weg, oder? -->
                            <table cellspacing=0 cellpadding=0>
                              <tbody>
                       <tr>
                              </tr>
                              </tbody>
                            </table>

                <table width="100%">
                              <tbody>
                              <tr>
                                <td align=middle width="50%">
                                  <table cellspacing=1 cellpadding=3 width=150 bgcolor=#555555>
                                    <tbody>
                                    <tr id=title bgcolor=#dbdbdb>

                <!-- hier fehlte eine apo am ende des link -->
                                      <td align=middle><a href="Seite1.php">Ja</a></td>
                                    </tr>
                                    </tbody>
                                  </table></td>
                                <td align=middle width="50%">
                                  <table cellspacing=1 cellpadding=3 width=150 bgcolor=#555555>
                                    <tbody>
                                    <tr id=title bgcolor=#dbdbdb>

                <!-- wo kommt das </font> her? -->
                                      <td align=middle><a href="javascript:pms_close()">Schließen</a></b></font></td>
                                    </tr>
                                    </tbody>
                                </table>
                              </td>
                            </tr>
                            </tbody>
                        </table>
                      </td>
                    </tr>
                    </tbody>
                  </table>
                  </td>
                  </tr>
                  </tbody>
                </table>
                </div>
                <script language=javascript>MMSetup();</script>

                </body>
                </html>

                1. ok, wunderbar - du hast es versucht. vom prinzip her ist nicht mehr viel zu ändern gewesen. ich habe an entpr. stellen einen kommentar gepackt. in meinem mozilla 1.5 läuft das jetzt genauso wie im ie, gib mal bescheid wie es bei dir aussieht ...

                  VIELEN DANK, es hat wunderbar funktioniert :o)

                  Gruß
                  G.M.