troubleshooting Question

Chrome and Safari not executing JavaScript correctly

Avatar of steva
steva asked on
JavaScript
6 Comments1 Solution371 ViewsLast Modified:
I have a small image  on my page that triggers a larger version of the image to appear on top of it when it's clicked:

 
<img id="img1_300" src="<?=$file1_300?>" onmousedown="showFullImage(img1_full)" />

The large image starts out with display:none and the showFullImage() function just sets its display to block:

function showFullImage(image) {
        image.style.display='block'; 
	document.getElementById('img1_300').style.display='none';
	document.getElementById('img2_300').style.display='none';
	document.getElementById('img3_300').style.display='none';
	document.getElementById('cap1').style.visibility='hidden';
	document.getElementById('cap2').style.visibility='hidden';
	document.getElementById('cap3').style.visibility='hidden';  
}

As you can see, I also turn off some other elements when I turn on the big image.

This works fine in Firefox and IE but nothing happens with Safari or Chrome. I can trigger an alert at the top of the JavaScript function on Safari and Chrome, so the function is being entered, but the statements aren't executing.

Does anyone know what might be going on?

Thanks
ASKER CERTIFIED SOLUTION
Roopesh Reddy
IT Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2012

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros