目前共有1篇帖子。
字体大小:较小 - 100% (默认)  内容转换:不转换
 
点击 回复
628 0
【代码】javascript按比例缩小图片
产品的注销
初入江湖 七级
回复
1楼 发表于:2010-12-19 10:57
function qmd_size(that){
 var new_width=436;
 var new_height=200;
 var src_width=that.width;
 var src_height=that.height;
 if (src_width>new_width || src_height>new_height){
  var radio=Math.max((src_width/new_width),(src_height/new_height));
  var width=Math.ceil(src_width/radio);
  var height=Math.ceil(src_height/radio);
  that.width=width;
  that.height=height;
 }return{
  width:width, //宽
  height:height //高
 }
}
回复帖子
内容:
用户名: 您目前是匿名发表。
验证码:
看不清?换一张
(快捷键:Ctrl+Enter)
本帖信息
点击数:628 回复数:0
作者:产品的注销
最后回复:产品的注销
最后回复时间:2010-12-19 10:57
本吧热门帖子
本吧精品帖子
公告板