Problem mit mehrerer positionierten Grafiken per DIV STYLE
Jürgen B.
0 André Laugks0 Alex
Hallo Forum,
ich hab leider noch ein kleines Problem.
Ich bin nicht in der Lage, mehrere positionierte Grafiken anzeigen zu lassen. Es wird immer nur die letzte in der REihe angezeigt, auch mit z-index. Was mache ich da denn falsch?
Hier der Code:
//Position des JD-Logo berechnen
logo_oben = ((Hoehe/2)-105);
logo_links = 47;
produkte_oben = (Hoehe-4-99-4-freiraum-38);
referenzen_oben = produkte_oben + 78;
kontakt_oben = produkte_oben + 78;
bilder_links = Breite-(Breite*10/100)-347;
source = '<div style="position:absolute;; left:100px; top:100px; z-index:1">';
source += '<img src="Grafik1.jpg" border="0" alt="">';
source += '</div>';
source = '<div style="position:absolute; left:100px; top:200px; z-index:2">';
source += '<img src="Grafik2.jpg" width="347" height="38" border="0" alt="">';
source += '</div>';
source = '<div style="position:absolute; left:100px; top:300px; z-index:3">';
source += '<img src="Grafik3.jpg" width="347" height="38" border="0" alt="">';
source += '</div>';
source = '<div style="position:absolute; left:100px; top:400px; z-index:4">';
source += '<img src="Grafik4.jpg" width="347" height="38" border="0" alt="">';
source += '</div>';
document.write(source);
Vielen Dank schon mal für eure Hilfe
Hallo!
source = '<div style="position:absolute;; left:100px; top:100px; z-index:1">';
source += '<img src="Grafik1.jpg" border="0" alt="">';
source += '</div>';
Bis hier OK!
source = '<div style="position:absolute; left:100px; top:200px; z-index:2">';
Hier "löschst" Du den String (erster Layer) in der Variable source und speicherst den zweiten Layer, weil
Du den zweiten Layer nicht mit += anhängst.
So sollte es richtig lauten:
source += '<div style="position:absolute; left:100px; top:200px; z-index:2">';
source = '<div style="position:absolute; left:100px; top:400px; z-index:4">';
Deshalb sieht man auch nur den dritten Layer.
Wegen dem "=", löschst Du den gesamten String(erster und zweiter Layer), der in der Variable source enthalten ist.
Komplet richtig ist es so:
source = '<div style="position:absolute;; left:100px; top:100px; z-index:1">';
source += '<img src="Grafik1.jpg" border="0" alt="">';
source += '</div>';
source += '<div style="position:absolute; left:100px; top:200px; z-index:2">';
source += '<img src="Grafik2.jpg" width="347" height="38" border="0" alt="">';
source += '</div>';
source += '<div style="position:absolute; left:100px; top:300px; z-index:3">';
source += '<img src="Grafik3.jpg" width="347" height="38" border="0" alt="">';
source += '</div>';
source += '<div style="position:absolute; left:100px; top:400px; z-index:4">';
source += '<img src="Grafik4.jpg" width="347" height="38" border="0" alt="">';
source += '</div>';
document.write(source);
mfg, André Laugks
Jup, genau so sehe ich das auch. :o)
Gruß
Alex