| 编程中国 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛
全能ASP/PHP/ASP.NET主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付学习型 ASP/PHP/ASP.NET 主机 30元/年
高端软件开发 = 年薪十万不是梦赛孚耐:软件保护加密专家身份认证令牌USB KEY 
共有 684 人关注过本帖
标题:按比例显示图片
收藏  订阅  推荐  打印 
favoriteran
Rank: 2
等级:注册会员
帖子:138
积分:1560
注册:2006-3-10
按比例显示图片

请头号asp中如何按比例显示图片,自动按比例缩放?
搜索更多相关主题的帖子: 缩放  头号  asp  自动  
2008-1-9 13:43
xmuer
Rank: 3Rank: 3
等级:中级会员
帖子:233
积分:2596
注册:2007-5-10
【无限缩小放大图片代码】

<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-1-9 22:42
madpbpl
Rank: 6Rank: 6
等级:金牌会员
威望:6
帖子:2513
积分:27228
注册:2007-4-5

前两个function有什么用?
2008-1-10 00:46
放任一切
Rank: 3Rank: 3
等级:中级会员
威望:4
帖子:216
积分:2268
注册:2007-3-22
图片成比例缩放

<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.163.com/photo/vfEgQ9Znr2SdwG5QuVn7Ww==/2325546257583803458.jpg"   

name="dd"   onload="DrawImage(this);">   
   
  </body>   
  </html>
2008-1-12 16:47
hangxj
Rank: 12Rank: 12Rank: 12
等级:贵宾
威望:29
帖子:2043
积分:20962
注册:2006-4-10

学习一下

http://www.52sai.com/
2008-1-12 18:00
关于我们 | 广告合作 | 编程中国 | 清除Cookies | Archiver | WAP | TOP

编程中国 版权所有,并保留所有权利。鲁ICP备08000592号
Powered by Discuz, Processed in 0.069399 second(s), 9 queries.
Copyright©2004-2008, BCCN.NET, All Rights Reserved