Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

This code is driving me crackers aka mad

Ok so I have created a very simple disjointed roll over using JavaScript it works 100% on my local server - pop it on line and just does not work at all. I have put it on here any help would be sooo appreciated http://jsfiddle.net/g6zQM/

8 Answers

Matt Campbell
Matt Campbell
9,767 Points

What's it meant to do when you do what?

Hi Matthew if you take a look at the live code on here http://www.justg.co.uk/rig-cms/danner-range and click on the Danner Recon Un-insulated (2nd row 1st product) the thumbnail when hovered over is suppose to change the main image.

The code for the bit in question starts around line 277

This is exactly the same code on exactly the same server - all be it not part of the wordpress site I am developing and it works fine http://www.justg.co.uk/danner-recon-uninsulated.php

I swapped out document.getElementById('mainImage1').src='http://www.justg.co.uk/rig-cms/img/products-large/danner-recon-2.jpg'; in my function to just show an alert and that works find so by the power of Greyskull it must be something to do with the above line of text

I swapped out document.getElementById('mainImage1').src='http://www.justg.co.uk/rig-cms/img/products-large/danner-recon-2.jpg'; in my function to just show an alert and that works find so by the power of Greyskull it must be something to do with the above line of text

Ignore all ramblings it works - good trust bit of trouble shooting of replacing code with things like alert() honestly I have been working on this for 12 hours and only just cracked it - but I cannot even tell you how happy I am

Chris Scott
Chris Scott
7,673 Points

It's a strange JSFiddle bug cause it worked for me on JSBin http://jsbin.com/amiQORU/1