网页中改变图片大小

< script language = " JavaScript "  type = " text/JavaScript " >
// 改变图片大小
function  resizepic()
{
    Pic
=document.body.getElementsByTagName("img");
    
for(i=0;i<Pic.length;i++)
    
{
        
if(Pic[i].width>500)
        
{
            Pic[i].height
=Pic[i].height*500/Pic[i].width;
            Pic[i].width
=500;
        }

    }

}

</ script >
</ head >
< body onload = javascript:resizepic() >
另外:
 1 < script language = " JavaScript "  type = " text/JavaScript " >
 2 // 改变图片大小
 3 function  resizepic(thispic)
 4 {
 5if(thispic.width>700){thispic.height=thispic.height*700/thispic.width;thispic.width=700;} 
 6}

 7 // 无级缩放图片大小
 8 function  bbimg(o)
 9 {
10  var zoom=parseInt(o.style.zoom, 10)||100;
11  zoom+=event.wheelDelta/12;
12  if (zoom>0) o.style.zoom=zoom+'%';
13  return false;
14}

15 // 双击鼠标滚动屏幕的代码
16 var  currentpos,timer;
17 function  initialize()
18 {
19timer=setInterval ("scrollwindow ()",30);
20}

21 function  sc()
22 {
23clearInterval(timer);
24}

25 function  scrollwindow()
26 {
27currentpos=document.body.scrollTop;
28window.scroll(0,++currentpos);
29if (currentpos !=document.body.scrollTop)
30sc();
31}

32 document.onmousedown = sc
33 document.ondblclick = initialize
34
35 // 更改字体大小
36 var  status0 = '';
37 var  curfontsize = 10 ;
38 var  curlineheight = 18 ;
39 function  fontZoomA() {
40  if(curfontsize>8){
41    document.getElementById('fontzoom').style.fontSize=(--curfontsize)+'pt';
42    document.getElementById('fontzoom').style.lineHeight=(--curlineheight)+'pt';
43  }

44}

45 function  fontZoomB() {
46  if(curfontsize<64){
47    document.getElementById('fontzoom').style.fontSize=(++curfontsize)+'pt';
48    document.getElementById('fontzoom').style.lineHeight=(++curlineheight)+'pt';
49  }

50}

51 </ script >
 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值