Avatar of steva
steva

asked on 

Chrome and Safari not executing JavaScript correctly

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
JavaScript

Avatar of undefined
Last Comment
steva

8/22/2022 - Mon