隨筆-153  評論-235  文章-19  trackbacks-0
               收集于網(wǎng)絡(luò),自已小改動下。
          有DrawImage(ImgD, width, height) 調(diào)整圖像比例的javascript函數(shù)。

          <script language="javascript">
          <!--

          var flag=false;
          function DrawImage(ImgD, width, height){
          var image=new Image();
          var iwidth = width;
          var iheight = height;
          image.src
          =ImgD.src;
          if(image.width>0 && image.height>0){
          flag
          =true;
          if(image.width/image.height>= iwidth/iheight){
          if(image.width>iwidth){
          ImgD.width
          =iwidth;
          ImgD.height
          =(image.height*iwidth)/image.width;
          }
          else{
          ImgD.width
          =image.width;
          ImgD.height
          =image.height;
          }
          ImgD.alt
          =image.width+""+image.height;
          }
          else{
          if(image.height>iheight){
          ImgD.height
          =iheight;
          ImgD.width
          =(image.width*iheight)/image.height;
          }
          else{
          ImgD.width
          =image.width;
          ImgD.height
          =image.height;
          }
          ImgD.alt
          =image.width+""+image.height;
          }
          }
          }
          //-->
          </script>
          <style type="text/css">
          .pic_size 
          {border:1px solid #CCCCCC;width:240px;height:200px;margin-top:5px;background:#FFF;}
          </style>
          <div class="pic_size"><table width="100%" height="100%"><tr><td style="text-align: center;vertical-align: middle;"><img src="my.jpg" onload = "DrawImage(this,240,200)"></td></tr></table></div>
          posted on 2008-03-16 12:43 流浪汗 閱讀(379) 評論(0)  編輯  收藏 所屬分類: HTML

           
          <2008年3月>
          2425262728291
          2345678
          9101112131415
          16171819202122
          23242526272829
          303112345

          留言簿(14)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          收藏夾

          友情鏈接

          同學(xué)鏈接

          學(xué)習(xí)鏈接

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 560399
          • 排名 - 86

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 五峰| 木兰县| 余江县| 贵港市| 巴青县| 乌鲁木齐县| 浮山县| 会同县| 福海县| 睢宁县| 亚东县| 太仓市| 霍林郭勒市| 琼结县| 育儿| 乌兰县| 文山县| 花垣县| 青州市| 永城市| 杨浦区| 珲春市| 泰兴市| 卓资县| 遵义县| 柘荣县| 克东县| 屏山县| 临汾市| 南部县| 乌拉特中旗| 塔城市| 龙山县| 固阳县| 分宜县| 奉节县| 贵州省| 陇西县| 车致| 新营市| 台中市|