- 论坛徽章:
- 0
|
我现在写了如下代码:
- window.addEventListener("scroll", pageScroll, false);
- pageScroll() {
- alert ("Page X off is:" + window.pageXOffset);
- alert ("Page Y off is:" + window.pageYOffset);
- }
复制代码
为何不论如何scroll bar, 返回的都是 0, 0阿
不过如下代码却可以正常工作
- ....
- <script>
- <!--
- // Called when the scroll event happens.
- function windowScroll() {
-
- var broX = window.pageXOffset;
- var broY = window.pageYOffset;
-
-
-
- alert ("Scrolling");
- alert (broX);
- alert (broY);
- alert (new Date().getTime());
- }
- // window.addEventListener("scroll", gAttentionRecorder.windowScroll, false);
- //-->
- </script>
- </head>
- <body onclick="windowScroll()">
- ....
复制代码
哪位牛人给解解惑阿 |
|