#9
|
|||
|
|||
Re: Opera 9 vs Firefox Review
[ QUOTE ]
Another, simpler approach is to use a "bookmarklet". This works in Opera and IE too. Here's one: javascript:maxwidth=800;pi=document.getElementsByT agName("img"); for(var%20i=0;i<=pi.length;i++){var%20aspectrat io=(pi.item(i).height/pi.item(i).width); if(pi.item(i).width>maxwidth){pi.item(i).width= 800;pi.item(i).height=aspectratio*800;}} [/ QUOTE ] Cool. But the maxwidth variable is silly if the magic number 800 is used twice later in the code. Change the code to ths javascript:maxwidth=800;pi=document.getElementsByT agName("img"); for(var%20i=0;i<=pi.length;i++){var%20aspectrat io=(pi.item(i).height/pi.item(i).width); if(pi.item(i).width>maxwidth){pi.item(i).width= maxwidth;pi.item(i).height=aspectratio*maxwidth;}} and the maximum width is set in that one place only. |
|
|