• JS控制图片显示的大小(图片等比例缩放)


    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <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>= 164/112){
       if(image.width>164){
        ImgD.width=164;
        ImgD.height=(image.height*164)/image.width;
       }else{
        ImgD.width=image.width;
        ImgD.height=image.height;
       }
       ImgD.alt=image.width+"x"+image.height;
      }
      else{
       if(image.height>112){
        ImgD.height=112;
        ImgD.width=(image.width*112)/image.height;
       }else{
        ImgD.width=image.width;
        ImgD.height=image.height;
       }
       ImgD.alt=image.width+"x"+image.height;
      }
     }
    }
    //-->
    </script>
    </HEAD>

    <BODY>

    <a href="./img.jpg" target="_blank"><img src="./img.jpg" border="0" width="164" height="112" onload="javascript:DrawImage(this);"></a>
    </BODY>
    </HTML>

  • 相关阅读:
    quartz 之misfire
    quartz 之job
    quartz 日志观察
    quartz集群原理2
    netty 之 GlobalEventExecutor
    redis 修改配置文件不起作用?
    Qto_MemberBaseQuantities
    Qto_PlateBaseQuantities
    Pset_BuildingElementProxyCommon
    matlab绘制函数(观察凹凸性)
  • 原文地址:https://www.cnblogs.com/Spring/p/163047.html
Copyright © 2020-2023  润新知