Firefox onmousewheel
发现 firefox 没有 mousewheel 事件,google 一下,汗!很多人相信 Firefox 根本没有这个事件,甚至有人居然用监听 onscroll 事件解决的问题。好不容易在一个新闻组里面发现一点线索,试着写了一小段代码,测试成功 :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
</head>
<body>
</body>
<script>
var n=0;
function mwEvent(e)
{
if (!e) e = window.event;
if ( e.wheelDelta <= 0 || e.detail > 0) { n++; }
else { n--; }
window.status=n;
}
if(document.attachEvent){
document.attachEvent("onmousewheel",mwEvent);
}else{
window.addEventListener("DOMMouseScroll", mwEvent, false);
}
</script>
</html>
原文:http://www.mmommo.com/?id=68
from:asp学习网/title:Firefox onmousewheel/ time:2007-2-24 21:08:53本文主题Firefox onmousewheel