Sebastian Becker: MouseOver-Script funktioniert nicht

Beitrag lesen

Hallo,

auf der Suche nach einem kompatiblen und einfach zu implementierenden MouseOver-Script habe ich mich für das folgende entschieden:

---------- schnipp ----------

// in externer .js-Datei:

var flag = false;

// load the on images, called with body onLoad()
function imageLoad()
{
if (document.images)
{
pic1on = new Image();
pic1on.src = "pictures/bild_on.gif";

// set the flag and let the function know know it can work          
return (flag = true);
}
}

if (document.images)
{
// load the off images in the normal way
pic1off = new Image();
pic1off.src = "pictures/bild.gif";
}

function rollIn(picName)
{
if (document.images && (flag == true))
{
document[picName].src = eval(picName + "on.src");
}
}
// the normal onMouseOut function
function rollOut(picName)
{
if (document.images)
{
document[picName].src = eval(picName + "off.src");
}
}

// und im body:

<a href="link.htm" onMouseOver="rollIn('pic1');return true" onMouseOut="rollOut('pic1');return true;"><img src="pictures/bild.gif" alt="zurück (nach Lage)" name="pic1"></a>

---------- schnipp ----------

Leider funktioniert es überhaupt nicht und meine Fehlersuche blieb bislang erfolglos. Vielleicht genügt der kurze Blick eines Profis, um den Fehler zu finden?!

Danke, Grüße,

Sebastian Becker