日期:2014-05-16 浏览次数:20397 次
function imageScale(ImgD,FitWidth,FitHeight){
var holdImg = "../Images/icons/loading.gif";
var image = new Image(),_width,_hegiht;
image.src = ImgD.src;
ImgD.src = holdImg; /* 问题在这行 和 下面最后一行 */
if(image.width>0 && image.height>0){
if(image.width/image.height>= FitWidth/FitHeight){
if(image.width>FitWidth){
_width=FitWidth;
_height=(image.height*FitWidth)/image.width;
}else{
_width=image.width;
_height=image.height;
}
} else{
if(image.height>FitHeight){
_height=FitHeight;
_width=(image.width*FitHeight)/image.height;
}else{
_width=image.width;
_height=image.height;
}
}
}
ImgD.width = _width;
ImgD.height = _height;
ImgD.src = image.src; /* 问题在这行 和前面的注释行 */
}
<script type="text/javascript">
&nb