1. <script language="JavaScript" type="text/javascript"> <!-- // 说明:用 JavaScript 实现网页图片等比例缩放 function DrawImage(ImgD,maxwidth,maxheight){ var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){ if(image.width/image.height>= maxwidth/maxheight){ if(image.width> maxwidth){ ImgD.width= maxwidth; ImgD.height=(image.height* maxwidth)/image.width; }else{ ImgD.width=image.width; ImgD.height=image.height; } } else{ if(image.height> maxheight){ ImgD.height= maxheight; ImgD.width=(image.width* maxheight)/image.height; }else{ ImgD.width=image.width; ImgD.height=image.height; } } } } //--> </script>

相关文章:

  • 2021-10-09
  • 2021-05-30
  • 2021-07-28
  • 2021-11-22
  • 2022-01-12
  • 2021-09-11
  • 2022-02-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
相关资源
相似解决方案