图片按比例缩放:图片等比例缩放代码来源: 发布时间:星期四, 2009年2月12日 浏览:237次 评论:0
var flag=false; function DrawImage(ImgD,iwidth,iheight){ var image= Image; image.src=ImgD.src; (image.width>0 && image.height>0){ flag=true; (image.width/image.height>= iwidth/iheight){ (image.width>iwidth){ ImgD.width=iwidth; ImgD.height=(image.height*iwidth)/image.width; }{ ImgD.width=image.width; ImgD.height=image.height; } //ImgD.alt=image.width+\"×\"+image.height; } { (image.height>iheight){ ImgD.height=iheight; ImgD.width=(image.width*iheight)/image.height; }{ ImgD.width=image.width; ImgD.height=image.height; } //ImgD.alt=image.width+\"×\"+image.height; } } /*{ ImgD.src=\"\"; ImgD.alt=\"\" }*/ } </script> <img src=\"图片路径\" _disibledevent=> 0
相关文章读者评论发表评论 |