Thomas: document.getElementById statt document.write

Hallo!

Ich bin am verzweifeln.

Ich habe einen document.write Befehl in eine Funktion gepackt. es öffnet sich ein Layer fenster. Der alte Inhalt wird überschrieben, deshalb habe ich einen div Bereich erstellt:

<div id="AusgabeBereich"></div>

und statt diesem Befehl:

document.write("<div id="popup" style="background-color:black; border-width:2px; border-color:silver; border-style:solid; width:"+basewidth+"px; height:"+baseheight+"px; position:absolute; left:"+layleft+"px; top:"+laytop+"px; z-index:1;" onmousedown="dragstart(this);"><table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" height="20"><tr><td align="center" valign="middle" style="background-color:navy;"><span style="font-family:Arial,sans-serif; font-weight:bold; font-size:12px; color:white; cursor:pointer; float:left; margin-left:4px; letter-spacing:4px;" onclick="top.location.href='<? echo $titleurl; ?>';"><? echo $titlename; ?></span><span style="font-family:Arial,sans-serif; font-weight:bold; font-size:12px; color:black; background-color:silver; padding-right:4px; padding-left:4px; margin-right:2px; margin-left:2px; border-width:1px; border-top-color:white; border-right-color:black; border-bottom-color:black; border-left-color:white; border-style:solid; cursor:pointer; float:right;" onclick="document.getElementById('popup').style.display='none';">X</span><span style="font-family:Arial,sans-serif; font-weight:bold; font-size:12px; color:black; background-color:silver; padding-right:4px; padding-left:4px; border-width:1px; border-top-color:white; border-right-color:black; border-bottom-color:black; border-left-color:white; border-style:solid; cursor:pointer; float:right;" onclick="minimieren();">_</span></td></tr></table><iframe src="http://www.domain.de/popup2.htm" name="popupiframe" width="100%" height=""+baseiframe+"" align="center" scrolling="no" marginheight="0" marginwidth="0" frameborder="0"></iframe></div>");

diesen eingesetzt:

document.getElementById("AusgabeBereich").innerHTML += "<div id="popup" style="background-color:black; border-width:2px; border-color:silver; border-style:solid; width:"+basewidth+"px; height:"+baseheight+"px; position:absolute; left:"+layleft+"px; top:"+laytop+"px; z-index:1;" onmousedown="dragstart(this);"><table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" height="20"><tr><td align="center" valign="middle" style="background-color:navy;"><span style="font-family:Arial,sans-serif; font-weight:bold; font-size:12px; color:white; cursor:pointer; float:left; margin-left:4px; letter-spacing:4px;" onclick="top.location.href='<? echo $titleurl; ?>';"><? echo $titlename; ?></span><span style="font-family:Arial,sans-serif; font-weight:bold; font-size:12px; color:black; background-color:silver; padding-right:4px; padding-left:4px; margin-right:2px; margin-left:2px; border-width:1px; border-top-color:white; border-right-color:black; border-bottom-color:black; border-left-color:white; border-style:solid; cursor:pointer; float:right;" onclick="document.getElementById('popup').style.display='none';">X</span><span style="font-family:Arial,sans-serif; font-weight:bold; font-size:12px; color:black; background-color:silver; padding-right:4px; padding-left:4px; border-width:1px; border-top-color:white; border-right-color:black; border-bottom-color:black; border-left-color:white; border-style:solid; cursor:pointer; float:right;" onclick="minimieren();">_</span></td></tr></table><iframe src="http://www.domain.de/popup2.htm" name="popupiframe" width="100%" height=""+baseiframe+"" align="center" scrolling="no" marginheight="0" marginwidth="0" frameborder="0"></iframe></div>";

darauf erhalte ich nun gar keine Ausgabe. Kann mir bitte einer weiterhelfen?

Grüße, Thomas

  1. Hi Thomas,

    wenn der html code an sich so läuft, sind es nur Auskommentierungsfehler:

    Das hier wird wohl kaum gehen:

    <iframe src="http://www.domain.de/popup2.htm"

    Und leg mal einfache Anführungszeichen um deine JS Variablen und im Zweifelsfall die auch auskommentieren.

    Sonst meld dich nochmal.

    Gruß
    Antipitch

  2. darauf erhalte ich nun gar keine Ausgabe. Kann mir bitte einer weiterhelfen?

    du kennst die Fehlerkonsole im Firefox?
    dort dürfte der Grund dafür stehen.

    Struppi.