Board logo

標題: 〔教學〕可將圖片用滑鼠滾輪放大縮小的語法 [打印本頁]

作者: sax0936     時間: 2005-9-7 03:30 AM    標題: 〔教學〕可將圖片用滑鼠滾輪放大縮小的語法

可將圖片用滑鼠滾輪放大縮小的語法==================================================================

<HTML>
<HEAD>
<SCRIPT>
var count = 10;
function Picture(){
count = Counting(count);
Resize(count);
return false;
}
function Counting(count){
if (event.wheelDelta >= 120)
count++;
else
if (event.wheelDelta <= -120) count--;
if (count > 0) { return count; }
else { return false; }
}
function Resize(count){
if (count > 0) {
oCount.value = count + '0%';
oImage.style.zoom = count + '0%';
}
else { oImage.style.zoom = '10%'; }
}
</SCRIPT>
</HEAD>
<BODY>
Size: <input type="text" value="100%" id="oCount" readonly><p>
<img id="oImage" src="http://msdn.microsoft.com/workshop/graphics/sprinter.jpg" onmousewheel="Picture()" width="283" height="212" ></p>
</BODY>
</HTML>
=================================================================


  QUOTE:
板主曰 : ` 謝謝您的分享! '

[ Last edited by TCG on 2005-9-16 at 12:43 PM ]
作者: minamoto     時間: 2005-9-7 09:42 PM
以圖片為主網頁有滾輪放大縮小的語法可增添網頁的專業感~~~
感謝分享~~~




歡迎光臨 網際論壇 (http://centurys.net/) Powered by Discuz! 2.5