zoukankan      html  css  js  c++  java
  • JS IE和火狐兼容性问题

        <script type="text/javascript">
            onload = function () {
               document.getElementById('dv').onmousemove = function () {
                    //兼容的写法
                    if (arguments.length>0) {
                        //火狐
                      document.title = arguments[0].clientX + '==' + arguments[0].clientY;
                   } else {
                        //IE
                        document.title = window.event.clientX + '==' + window.event.clientY;
                   }

                    //通过下面的方式发现火狐浏览器有参数
                    // alert(arguments.length);
                    // alert(arguments[0]);
                    //火狐的写法
                   // document.title = arguments[0].clientX + '==' + arguments[0].clientY;
                    //相对于页面的左上角的坐标,横坐标和纵坐标
                    //document.title = window.event.clientX + '==' + window.event.clientY;
                    //相对于屏幕左上角的坐标
                    // document.title = window.event.screenX + '==' + window.event.screenY;
                    //相对于当前层的左上角的坐标
                    // document.title = window.event.offsetX + '==' + window.event.offsetY;
    //            };
    //        };
    //    

        </script>

    innerText在火狐不管用,要用textContent

  • 相关阅读:
    小M和天平(简单DP)
    前缀查询(维护字典树前缀和)
    假的字符串( trie树 + 拓扑)
    E. Two Teams(线段树+链表)
    B. Ugly Pairs(简单dfs)
    回文(牛客 https://ac.nowcoder.com/acm/problem/17062)
    Dubbo中CompletableFuture异步调用
    Dubbo消费者异步调用Future使用
    Dubbo消费者异步调用Future使用
    Dubbo服务暴露延迟
  • 原文地址:https://www.cnblogs.com/dxmfans/p/9434866.html
Copyright © 2011-2022 走看看