We help IT Professionals succeed at work.
Get Started

Chrome and Safari not executing JavaScript correctly

steva
steva asked
on
370 Views
Last Modified: 2012-07-03
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)" />

Open in new window


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';  
}

Open in new window


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
Comment
Watch Question
IT Analyst
Top Expert 2012
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE