中文(繁体)
<html> <head> <script type="text/javascript"> 函式句柄(delta) { var s = delta + ": "; if (delta <0) s += "向下";否則 s += "向上"; document.getElementById('delta').innerHTML = s; }//來自 downcodes.com functionwheel(event){ var delta = 0; if (!event) event = window.event; if (event.wheelDelta) { delta = event.wheelDelta/120; if (window.opera) delta = -delta; } else if (event.detail) { delta = -event.detail/3;如果(增量)句柄(增量); } /* 初始化程式碼。 */ if (window.addEventListener) window.addEventListener('DOMMouseScroll', Wheel, false); window.onmousewheel = document.onmousewheel = 輪子; </script> </head> <body> <div id="delta">滾動滑鼠中間的滾輪可以看到效果</div> </body> </html>