Thomas N: Dynamische grafische Buttons, Wechsel für mehrere Grafiken?

Beitrag lesen

Hallo ueps,

was hab ich DAU mich gequält!
Ich hab im Buch "Webdesign in a Nutshell" de, 2.Auflage ein komplettes Bsp. gefunden und es funktioniert, guck mal, die Bildern haben jetzt auch "namen", wie gefällt es Dir?

<html>
<head>
<title>Dynamische grafische Buttons</title>
<script type="text/javascript">
<!--
if (document.images)
{
img1on = new Image();
img1on.src = "image1on.gif";

img1off = new Image();
img1off.src = "image1off.gif";

img1info = new Image();
img1info.src = "image1info.gif";
}

function imgOn(imgName)
{
        if (document.images)
        {
                document.images[imgName].src = eval(imgName + "on.src");
                document.images["holder"].src = eval(imgName + "info.src");
        }
}

function imgOff(imgName)
{
         if (document.images)
                {
                document.images[imgName].src = eval(imgName + "off.src");
                document.images["holder"].src = "clear.gif";
                }
}
//-->
</script></head><body>
<a href="page1.htm" onMouseOver="imgOn('img1')"
onMouseOut="imgOff('img1')">
<img name="img1" src="image1off.gif" width="96" height="24" border="0"></a>
<br><br>
<img name="holder" src="clear.gif" width="150" height="70" border="0">
</body>
</html>

Viele Grüsse
Thomas N == Neu-User

P.S. Dies war ja der Ausgangspunkt, ich habe den Link jedesmal vergessen einzufügen!
Dynamische grafische Buttons:
http://selfhtml.teamone.de/javascript/beispiele/buttons.htm