Ole: animierte Buttons

Beitrag lesen

hi sabine,

warum dhtml? hier ein kleines java script mit dem es auch ganz einfach geht.

die folgende source in eine datei packen z.B. button.js :

//

if (document.images) {

doc0 = new Image()
        doc0.src =      "001nr.gif"

}

function HighLight(i) {
        if (document.images) {
                var thang = document.images[i].src
                var off = thang.lastIndexOf("nr")
                if (off != -1) {
                        document.images[i].src = thang.substring(0,off) + "lt" + ".gif"
                }
        }
}

function Lightsoff(i) {
        if (document.images) {
                var thang = document.images[i].src
                var on = thang.lastIndexOf("lt")
                if (on != -1) {
                        document.images[i].src = thang.substring(0,on) + "nr" + ".gif"                }
        }
}

dann in der html datei einbinden:

<html>
<head>
<SCRIPT language="JavaScript" src="buttons.js"></SCRIPT>
</head>

<body>
<a href="site02.htm" target="target01" onmouseover="HighLight(0)" onmouseout="Lightsoff(0)"><img src="bild_nr.gif"></a>
</body>
</html>

die erste grafik heisst in diesem fall bild_nr.gif und wird mit bild_lt.gif ausgetauscht.

alles liebe
ole
(8-)>