Question : Show/Hide All Images

I'm using a script to hide/show all images on a page. The script works fine in Firefox, however it does not work in Internet Explorer. Can you see anything obvious that would make it not work in IE or is there a better way?

I've attached the script an implementation

Attachments:
 
show hide all image
 

Answer : Show/Hide All Images

<head>
<script>
function hide(which) {

for (i=0;i<document.images.length ;i++ )
{
document.images[i].style.display='none'
}
}
function show(which) {

for (i=0;i<document.images.length ;i++ )
{
document.images[i].style.display='block';
}

}
</script>
</head>

Here is the implementation:

<input type='radio'name='showhideimages' onclick="hide('myIMG');">Hide Images <input type='radio'name='showhideimages' onclick="show('myIMG');">Show Images


<div name='myIMG' style='float: left;padding-right: 20px;width: 150px;'><img  src='image1.jpg'width='130' alt='Image1'border='0' /></div><br />

<div name='myIMG' style='float: left;padding-right: 20px;width: 150px;'><img  src='image2.jpg'width='130' alt='Image2'border='0' /></div><br />

<div name='myIMG' style='float: left;padding-right: 20px;width: 150px;'><img  src='image3.jpg'width='130' alt='Image3'border='0' /></div>

etc...
Random Solutions  
 
programming4us programming4us