Ett script för att ändra en bild när musmarkören förs över den.
<html><head><title>imageSwap1_1.html</title>
<script language="javascript1.3">
imgObj="bild";
imgObjLinks=["http:\/\/www.webforum.nu","http:\/\/www.webforum.nu","http:\/\/www.webforum.nu","http:\/\/www.webforum.nu","http:\/\/www.webforum.nu"]
for(i=1,j=0;i<=5;i++,j++){
eval(imgObj+i+"href=imgObjLinks["+j+"]")
eval(imgObj+i+"Off=new Image()");
eval(imgObj+i+"Off.src='bilder/off"+i+".gif'");
eval(imgObj+i+"On=new Image()");
eval(imgObj+i+"On.src='bilder/on"+i+".gif'");
}
ie=(document.all)?1:0;
ns4=(document.layers)?1:0;
function setName(e){
if(ie) targetNode=event.srcElement, name=targetNode.name; else targetNode=e.target, name=targetNode.name;
}
function over(e){ setName(e);
if(name.substr(0,4)==imgObj){ eval("document."+name+".src="+name+"On.src"); if(!ns4) status=targetNode.alt; }}
function out(e){if(name.substr(0,4)==imgObj)
eval("document."+name+".src="+name+"Off.src"); status="";}
function clk(e){ setName(e);if(name.substr(0,4)==imgObj) location.href=eval(name+"href")}
if(!ie){document.captureEvents(1|4|8);}
document.onmouseover=over;document.onmouseout=out;document.onmousedown=clk;
</script></head><body>
<img src="bildOff1.gif" name="bild1" border="5" alt="bild nummer 1">
<img src="bildOff2.gif" name="bild2" border="5" alt="bild nummer 2">
<img src="bildOff3.gif" name="bild3" border="5" alt="bild nummer 3">
<img src="bildOff4.gif" name="bild4" border="5" alt="bild nummer 4">
<img src="bildOff5.gif" name="bild5" border="5" alt="bild nummer 5">
</body></html>