| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1198 人关注过本帖
标题:按比例显示图片
只看楼主 加入收藏
favoriteran
Rank: 1
等 级:新手上路
帖 子:142
专家分:0
注 册:2006-3-10
收藏
 问题点数:0 回复次数:4 
按比例显示图片
请头号asp中如何按比例显示图片,自动按比例缩放?
搜索更多相关主题的帖子: 缩放 头号 asp 自动 
2008-01-09 13:43
xmuer
Rank: 1
等 级:新手上路
帖 子:236
专家分:0
注 册:2007-5-10
收藏
得分:0 
【无限缩小放大图片代码】
<input type="button" value="缩小" onclick="small1()">
              <input type="button" value="放大" onclick="big1()">
              <br>
              <BR>
              <img border="0"  name=images1 src="图片.jpg">
          <script>
function small(){
var height1=images0.height
var width1=images0.width
images0.height=height1/1.5
images0.width=width1/1.5}

function big(){
var height1=images0.height
var width1=images0.width
images0.height=height1*1.5
images0.width=width1*1.5}

function small1(){
var height1=images1.height
var width1=images1.width
images1.height=height1/1.5
images1.width=width1/1.5}

function big1(){
var height1=images1.height
var width1=images1.width
images1.height=height1*1.5
images1.width=width1*1.5}
</script>
2008-01-09 22:42
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
前两个function有什么用?
2008-01-10 00:46
放任一切
Rank: 2
等 级:新手上路
威 望:4
帖 子:217
专家分:0
注 册:2007-3-22
收藏
得分:0 
图片成比例缩放
<script>   
  function   DrawImage(ImgD){   
        var   image=new   Image();   
        var   iwidth   =   120;     //定义允许图片宽度   
        var   iheight   =   90;     //定义允许图片高度   
        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>   
   
   
   
   
  <html><body>   
  <img   src="http://img.blog.   

name="dd"   onload="DrawImage(this);">   
   
  </body>   
  </html>
2008-01-12 16:47
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
学习一下

http://www./
2008-01-12 18:00
快速回复:按比例显示图片
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018649 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved