Thomas Häber: Variablen unter getElementById

Beitrag lesen

Guten Abend,

Habe diesen Script der dynamisch einige Links auf meine Seite lädt. Da das aber auch zu Netscape 6.x usw. kompatibel sein soll, versuche ich den unten aufgeführten dynamischen Eintrag als getElementById zu machen, da ich aber eine Variable dabei habe gibt es einige Probleme um es korrekt ausführen zu lassen.

Zur Probe habe ich (erstmal ohne getElementById) den Script in der optionalen URL noch mal angegeben.

(Ich habe auch mit der Forums-Suche danach gestöbert habe jedoch nur veraltete Links aufspüren können.)

<html><head>
<title>Location auswerten - by Thomas Häber</title>
<script language="JavaScript" type="text/javascript">
<!--
  function Zeugs() {
  var URLInhalt = location.href;

if (window.location.host == true) {
  var Ab_Menu = window.location.pathname;
  }
  else {
  var hq1 = URLInhalt.indexOf("haeber_de/");
  var Ab_Menu = URLInhalt.substring(hq1,999);
  }
  ArrayVariable = Ab_Menu.split("/");

hz = "1";
  while (unescape(ArrayVariable[hz]) != "undefined") {
  hz++;
  }
  hz2 = hz-2;

Adresse = "";
  Verweise = "";
  hq = "1";
  var Vorverweis = "";
  var Zusatz = "<span style='color:#000000;'> - </span>";
  var Verweis1 = "<a id='Navigation' style='color:#000000;font-family:Arial,Verdana;text-decoration:none;' href='";
  var Verweis2 = "'></a>";
  var Punkt = "../";
  var Indexlink = "index.html";

function Dlayer(xx,yy) {
  if (document.getElementById) document.getElementById(xx).innerHTML = yy;
  else if (document.all) document.all.xx.innerHTML = yy;
  else if (document.layer) {
  document.xx.document.open();
  document.xx.document.write(yy);
  document.xx.document.close();
  }
  }

while (unescape(ArrayVariable[hq]) != "undefined") {
  if (hz2 == 0) Adresse = "javascript:location.reload()";
  else {
  Punkt2 = "";
  for (pp = 2; pp <= hz2; pp++) {Punkt2 = Punkt2.concat(Punkt);}
  Adresse = Punkt2.concat(Indexlink);
  hz2--;
  }

Vorverweis  = Verweis1.concat(Adresse);
  Verweis = Vorverweis.concat(Verweis2);
  if (hq == "1") Verweise = Verweise.concat(Verweis);
  else Verweise = Verweise.concat(Zusatz + Verweis);
  Neues = Verweise;

Dlayer("Navdiv",Neues,"ja");
  hq++;
  Vorverweis = "";
  Neues = "";
  }

i = "0";
  hp = "1";
  while (unescape(ArrayVariable[hp]) != "undefined") {
  s = unescape(ArrayVariable[hp]);
  x = s;

if (x == "forum")      x = "Forum";
  if (x == "info")       x = "Information";
  if (x == "extras")     x = "Extras";
  if (x == "menu")       x = "Menu";
  if (x == "gaestebuch") x = "Gästebuch";
  if (x == "spiele")     x = "Spiele";

if (x == "haeber")     x = "Haeber Community";
  if (x == "preview")    x = "Preview";
  if (x == "action")     x = "Action";
  if (x == "denken")     x = "Denken-Logik";
  if (x == "fun")        x = "Fun";
  if (x == "strategie")  x = "Strategie";
  if (x == "gimmicks")   x = "Gimmicks";
  if (x == "links")      x = "Links";

<!-- Genau hier drunter habe ich Probleme mit dem getElementById -->

if (document.getElementById) document.getElementById(Navigation[i]).innerHTML = x;
  else if (document.all) document.all.Navigation[i].innerHTML = x;
  else if (document.layer) {
  document.Navigation[i].document.open();
  document.Navigation[i].document.write(x);
  document.Navigation[i].document.close();
  }

i++;
  hp++;
  }
}
//-->
</script></head>
<body onLoad="Zeugs();return true;">

<div align="center" id="Navdiv" style="color:#000000;"></div>

</body></html>