<script language="JavaScript">
<!--
var flag=false;
function DrawImage(ImgD){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= ImgD.width/ImgD.height){
if(image.width>ImgD.width){
ImgD.width=ImgD.width;
ImgD.height=(image.height*ImgD.width)/image.width;
}
else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
else{
if(image.height>ImgD.height){
ImgD.height=ImgD.height;
ImgD.width=(image.width*ImgD.height)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
ImgD.alt=image.width+"×"+image.height;
}
}
}
//-->
</script>
然后调用