onmousemove活动在Chrome中无效

时间:2012-04-09 05:27:24

标签: javascript

我已经编写了onmousemove事件在Firefox和IE中运行良好但不在Chrome中的代码:

         var mouse;
         function storeMouse(e) {
             if (!e) e = window.event;
             mouse = { clientX: e.clientX, clientX: e.clientY };
         }

         function test(e) {
             alert(mouse.clientX);
             if (mouse.clientX < 150) {
                 var agree = confirm("Are you sure to leave this page");
                 if (!agree) {
                     return false;
                 }
                 else {

                 }
             }
         }

1 个答案:

答案 0 :(得分:2)

第4行的问题:重复mouse.clientX