复制代码代码如下 :
<Langage SCRIPT="JavaScript">
fonction DrawImage (ImgD, FitWidth, FitHeight) {
var image=nouvelle image();
image.src=ImgD.src;
si (image.width>0 && image.height>0){
si (image.width/image.height>= FitWidth/FitHeight){
si(image.width>FitWidth){
ImgD.width=FitWidth ;
ImgD.height=(image.height*FitWidth)/image.width;
}
autre{
ImgD.width=image.width;
ImgD.hauteur=image.hauteur ;
}
}
autre{
si(image.height>FitHeight){
ImgD.height=FitHauteur ;
ImgD.width=(image.width*FitHeight)/image.height;
}
autre{
ImgD.width=image.width;
ImgD.hauteur=image.hauteur ;
}
}
}
}
</script>
调用方法:
复制代码代码如下 :
<a href="admin/<? echo $rscase['path']?>" target="_blank"><img src="admin/<? echo $rscase['path']?>" onload='javascript :DrawImage(this,180,);' hspace="3" vspace="3" /></a>