|
Nice... Can you do the clicking thing??
var oldwidths=new Array();
var maxwid=450;
function resimgs(){var i;var img;
for(i=0;i<document.images.length;i++){
img=document.images[i];
if(img.width > maxwid){
oldwidths[img.name]=img.width;
img.width=maxwid;
}
}
}
function clkimg(img){
if(img.width > maxwid){
img.width=maxwid;
}else if(oldwidths[img.name]){
img.width=oldwidths[img.name];
}
}
for the body tag
onLoad="resimgs();"
for each applicable image
<img src="" name="img1" onClick="clkimg(this);">
each image has to have a unique name. The one problem is that this solution will curently resize ANY image (including banners).. You could put in a name check though and make sure any images you possibly want resized start with a string that you would check for. Let me know if you need that code as well.
Works in IE, Opera, Netscape 7 and 8 but my Firefox is broken so couldn't test it.
Clicking on the images toggles between full and min size.
|