Preload images + onMouseOver/out problem.
Hejsa..Et klogt hovede, der kan fortælle mig, hvad jeg har gjort galt? :)
Vil preloade filerne til menuen, så det hele kan bruges til menuen med mouseOver/Out - men af en eller anden grund, vil det altså ikke virke.
Jeg bruger følgende i <HEAD>:
<script type="text/javascript">
var homeoff = new Image();
var homeon = new Image();
var aboutoff = new Image();
var abouton = new Image();
var eventoff = new Image();
var eventon = new Image();
var affiliatesoff = new Image();
var affiliateson = new Image();
var pressoff = new Image();
var presson = new Image();
var contactoff = new Image();
var contacton = new images();
homeoff.src="gfx/menu/homeoff.jpg";
homeon.src="gfx/menu/homeon.jpg";
aboutoff.src="gfx/menu/aboutoff.jpg";
abouton.src="gfx/menu/abouton.jpg";
eventoff.src="gfx/menu/eventoff.jpg";
eventon.src="gfx/menu/eventon.jpg";
affiliatesoff.src="gfx/menu/affiliatesoff.jpg";
affiliateson.src="gfx/menu/affiliateson.jpg";
pressoff.src="gfx/menu/pressoff.jpg";
presson.src="gfx/menu/presson.jpg";
contactoff.src="gfx/menu/contactoff.jpg";
contacton.src="gfx/menu/contacton.jpg";
function loading(){
document.Homeon.src=homeon.src;
document.Abouton.src=abouton.src;
document.Eventon.src=eventon.src;
document.Affiliateson.src=affiliateson.src;
document.Presson.src=presson.src;
document.Contacton.src=contacton.src;
}
function unloading(){
document.Homeoff.src=homeoff.src;
document.Aboutoff.src=aboutoff.src;
document.Eventoff.src=eventoff.src;
document.Affiliatesoff.src=affiliatesoff.src;
document.Pressoff.src=pressoff.src;
document.Contactoff.src=contactoff.src;
}
</script>
Hvor menuen er placeret, er der brugt:
<a href="?page=home" onMouseOver="document.Homeon.src=homeon.src;" onMouseOut="document.Homeoff.src=homeoff.src;">
<img src="gfx/menu/homeoff.jpg" name="Home" width="60" height="28" border="0" /></a>
<a href="?page=about" onMouseOver="document.Abouton.src=abouton.src;" onMouseOut="document.Aboutoff.src=aboutoff.src;">
<img src="gfx/menu/aboutoff.jpg" name="About" width="70" height="28" border="0" /></a>
<a href="?page=event" onMouseOver="document.Eventon.src=eventon.src;" onMouseOut="document.Eventoff.src=eventoff.src;">
<img src="gfx/menu/eventoff.jpg" name="Event" width="63" height="28" border="0" /></a>
<a href="?page=affiliates" onMouseOver="document.Affiliateson.src=affiliateson.src;" onMouseOut="document.Affiliatesoff.src=affiliatesoff.src;">
<img src="gfx/menu/affiliatesoff.jpg" name="Affiliates" width="108" height="28" border="0" /></a>
<a href="?page=press" onMouseOver="document.Presson.src=presson.src;" onMouseOut="document.Pressoff.src=pressoff.src;">
<img src="gfx/menu/pressoff.jpg" name="Press" width="65" height="28" border="0" /></a>
<a href="?page=contact" onMouseOver="document.Contacton.src=contacton.src;" onMouseOut="document.Contactoff.src=contactoff.src;">
<img src="gfx/menu/contactoff.jpg" name="Contact" width="124" height="28" border="0" /></a>
De nødvendige filer og mapper, har de nødvendige læse/skrive tilladelser
Live test kan ses på følgende: www.5frames.dk/diverse/carrotmob/main.php
Hjælp! :)