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

  • 相关阅读:
    为什么今天的L4无人驾驶无法到达终局(转)
    各种卷积类型Convolution
    关于快速、深入理解需求
    测试注意事项及工作标准
    测试工作指引
    测试验收工作指引
    Jmeter的json提取器使用
    高等数学:第一章 函数与极限
    vscode
    Python模块查找路径
  • 原文地址:https://www.cnblogs.com/dxmfans/p/9434866.html
Copyright © 2011-2022 走看看