zoukankan      html  css  js  c++  java
  • js图片等比缩放

    <script language="JavaScript" type="text/javascript">
     <!-- 
    function DrawImage(ImgD,FitWidth,FitHeight){
         var image=new Image();
         image.src=ImgD.src;
         if(image.width>0 && image.height>0){
             if(image.width/image.height>= FitWidth/FitHeight){
                 if(image.width>FitWidth){
                     ImgD.width=FitWidth;
                     ImgD.height=(image.height*FitWidth)/image.width;
                 }else{
                     ImgD.width=image.width; 
                    ImgD.height=image.height;
                 }
             } else{
                 if(image.height>FitHeight){
                     ImgD.height=FitHeight;
                     ImgD.width=(image.width*FitHeight)/image.height;
                 }else{
                     ImgD.width=image.width; 
                    ImgD.height=image.height;
                 } 
            }
         }
     }
     //-->
     </script>

    <img src="XXXX" alt="自动缩放后的效果"  onload="javascript:DrawImage(this,"200","200");" />

    图片外边框
    <table width='150' height='150' border='0' cellpadding='0' cellspacing='0' style='border: 1px solid #666666; display:block; 150px; height:150px;padding:50px;'>
      <tr>
        <td width='300' height='68' align='center'>&nbsp;</td>
      </tr>
    </table>

  • 相关阅读:
    Flutter图片选择 image_picker(官方)插件使用详解
    androidstudo如何跨越这个厚厚的墙,亲测有效 Could not resolve com.android.tools.build:gradle:
    qwq。。胡诌qwq
    关于很狗的军训qwq
    Leetcode每日一题 503.下一个更大元素II
    C++ 关于volatlie
    C++虚成员函数与动态联编
    graphics pipeline
    pointer or function
    线段树
  • 原文地址:https://www.cnblogs.com/anbylau2130/p/3123243.html
Copyright © 2011-2022 走看看