小小算法, 同比例放大缩小在一个固定的框中

1<script>
2                            document.write("<img ");
3                            var imgwid=<bean:write name="list" property="width" />;var imgheigh=<bean:write name="list" property="height" />;if(imgwid/105>imgheigh/95){document.write("width=105"+" height="+imgheigh*105/imgwid);}else{document.write("width="+imgwid*95/imgheigh+" height=95");}
4                            document.write(" src='photos/<bean:write name="list" property="udirectory" />/<bean:write name="list" property="filename" />_s.jpg' border=0>");
5                            </script>
原文地址:https://www.cnblogs.com/QDuck/p/440322.html