PDA

View Full Version : Simple Javascript Image Rollovers



kirstybandm
01 Aug 2006, 05:34 AM
hi,
I've built a sample site for a job interview and thought it would be a good idea to use it as an excuse to start learning javascript. I'm very new to handcoding Javascript so thought I would start off with an easy rollover image for my top nav.

I've got my script to work but only if the second image is a .jpg I've already used on the page.

You can see this at:
www.bandm.co.uk/RB/mouldings.html

I want each rollover to use the relevant images i.e. for the mouldings link I want to use 'mouldingsicon.jpg' and 'mouldingicons1.jpg' for the decking link I want 'deckingicon.jpg' and 'deckingicon1.jpg' etc. But for some reason my page can only find 'mouldingsicon.jpg' (which I've used on the page) and not 'mouldingsicon1.jpg'.

You can see this at:
www.bandm.co.uk/RB/index.html (This site has been uploaded so I can test for browser compatability. If using IE it may not display correctly at the moment, Firefox is perfect though.)

Am I doing something very obviously wrong?

Kirsty

cdwhalley.com
02 Aug 2006, 06:19 AM
The rollovers all seem to be working perfectly to me. Maybe the problem was in that the mouseover images weren't loaded the first time you put the mouse over them? If that's the case, perhaps you should try writing a preloading script to go with your rollovers...