图片缩放js

<script language=javascript>
function propersize(a)
{

var width1=images2.width;           
var height1=images2.height;           
var width2=660;           
var height2=500;           
var h=height1/height2;
var w=width1/width2;
if(height1<height2&&width1<width2)
{
  images1.height=height1;           
  images1.width=width1;          
}
else
{
  if(h>w)
  {
   images1.height=height2;         
   images1.width=width1*height2/height1;          
  }
  else
  {
   images1.width=width2;          
   images1.height=height1*width2/width1;         
  }
}
}
</script>
<script language="javascript">
var count = 10;
function resizeimg(oImage)
{
count = Counting(count);
Resize(oImage,count);
return false;
}
function Counting(newzoom){
if (event.wheelDelta >= 120)
newzoom++;
else if (event.wheelDelta <= -120)
newzoom--;
if (newzoom<2) newzoom=2; ////只允许缩小到20%
if (newzoom>30) newzoom=30; ////只允许放大到300%

return newzoom;
}
function Resize(oImage,newzoom){
if(oImage.width*newzoom*0.1<=650 && oImage.height*newzoom*0.1<=500)
{
oImage.style.zoom = newzoom + '0%';
count=newzoom;
}
}
</script>

posted @ 2006-10-13 16:33 ddr888 阅读(398) 评论(0)  编辑 收藏 网摘 所属分类: javascript代码




标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2006-10-17 09:02 编辑过
Google站内搜索


China-pub 计算机图书网上专卖店!6.5万品种 2-8折!
近千种 9-95 新二手计算图书火热销售中!

相关文章:

相关链接: