實現鼠標滾動滾輪事件:
<script type="text/javascript"> var scrollFunc=function(e){ e=e || window.event; if(e.wheelDelta){//IE/Opera/Chrome if(e.wheelDelta==120) { //向上滾動事件 alert(e.wheelDeta +"向上"); }else { //向上滾動事件 alert(e.wheelDeta +"向上"); } }else if(e.detail){ //Firefox if(e.detail==-3) { //向上滾動事件<br> alert(e.detail +"向上"); }else { //向下滾動事件<br> alert(e.detail +"向下 "); } } }; if(document.addEventListener){ //adding the event listerner for Mozilla document.addEventListener("DOMMouseScroll" ,scrollFunc, false); } //IE/Opera/Chrome window.onmousewheel=document.onmousewheel=scrollFunc; </script>