網路城邦
上一篇 回創作列表 下一篇   字體:
071205系統分析與設計-縮放圖片
2007/12/05 09:46:52瀏覽256|回應0|推薦0

<HTML>
<head>
<title>縮放圖片</title>
<script language=JavaScript>
var h,w; //h:高 w:寬
  function getImgSize() { //取得圖片大小
    h=document.img1.height
    w=document.img1.width
  }
  function restore() { //還原
    document.img1.height=h;
    document.img1.width=w;
  }
  function zoomIn() { //放大
    document.img1.height *=1.2;
    document.img1.width *=1.2;
  }
  function zoomOut() { //縮小
    document.img1.height /=1.2;
    document.img1.width /=1.2;
  }
</script>
</head>
<BODY onLoad="getImgSize()">
<p align=center>
<form>
<input type=button onclick="zoomIn()" value="Zoom In (+)">
<input type=button onclick="restore()" value="原始大小">
<input type=button onclick="zoomOut()" value="Zoom Out (-)">
<br>
<img border="0" src="untitled.jpg" name="img1" width="338" height="338"></p>

</BODY>
</HTML>

( 心情隨筆心情日記 )
回應 推薦文章 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=crystal9683&aid=1428499