.net新手

人生就像一场旅行,不必在乎目的地,在乎的是沿途的风景以及欣赏风景的心情!

导航

网页中改变图片大小

<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//改变图片大小
 3function resizepic(thispic)
 4{
 5if(thispic.width>700){thispic.height=thispic.height*700/thispic.width;thispic.width=700;} 
 6}

 7//无级缩放图片大小
 8function 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//双击鼠标滚动屏幕的代码
16var currentpos,timer;
17function initialize()
18{
19timer=setInterval ("scrollwindow ()",30);
20}

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

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

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

44}

45function 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>

posted on 2007-04-16 17:13  sinoese  阅读(867)  评论(0编辑  收藏  举报