Andreas: Bildwechsel

Hallo,
ich habe bis jetzt diese funktion verwendet um die Bilder auszutauschen. Nun habe ich aber alles überarbeitet und benutze statt 12 jetzt 34 Bilder. Entweder verlängere ich jetzt meine funktion oder ihr könnt mir helfen.
Gibt es einnen Befehl der z.B. Bild 0-33 zurüchsetzt?

<script language="JavaScript">
<!--
function func(x,y)
{document.images[0].src="rund1.gif";
document.images[1].src="rund1.gif";
document.images[2].src="rund1.gif";
document.images[3].src="rund1.gif";
document.images[4].src="rund1.gif";
document.images[5].src="rund1.gif";
document.images[6].src="rund1.gif";
document.images[7].src="rund1.gif";
document.images[8].src="rund1.gif";
document.images[9].src="rund1.gif";
document.images[10].src="rund1.gif";
document.images[11].src="rund1.gif";
document.images[12].src="rund1.gif";
 document.images[y].src=x }
//-->
</script>

MfG. Andreas

  1. Hallo

    Schlag in SelfHTML einmal Schleifenkonstruktionen nach. die for-Schleife kannst du einfach über alle Bilder jagen und die Zählervariabel als Index des Bildes verwenden. Das sind nacher dann 2,3 Zeilen Code.

    Grüße

    David

    --
    "Nobody will ever need more than 640k RAM!"
    1981 Bill Gates