zoukankan      html  css  js  c++  java
  • kindeditor浏览器兼容性问题

    1、kindeditor在IE下出现异常“对象不支持“attachEvent”属性或方法”

      通过开发人员工具会发现:

       这时问题就很明了,也就是IE11版本不支持“attachEvent”;

      解决方案:通过window.attachEvent和window.addEventListener监听事件,完美解决问题!

      

    2、addEventListener的使用方式:

      target.addEventListener(type, listener, useCapture);

      target: 文档节点、document、window 或 XMLHttpRequest。
      type: 字符串,事件名称,不含“on”,比如“click”、“mouseover”、“keydown”等。
      listener :实现了EventListener 接口或者是 JavaScript 中的函数。
      useCapture :是否使用捕捉,一般用 false 。

        例如:document.getElementById("testText").addEventListener("keydown", function (event) { alert(event.keyCode); }, false);

    3、target.attachEvent(type, listener);
      target: 文档节点、document、window 或 XMLHttpRequest。
      type: 字符串,事件名称,含“on”,比如“onclick”、“onmouseover”、“onkeydown”等。
      listener :实现了 EventListener 接口或者是 JavaScript 中的函数。
      例如:document.getElementById("txt").attachEvent("onclick",function(event){alert(event.keyCode);});

    4、两者区别

      在IE10及以下版本兼容attachEvent,IE11及火狐兼容addEventListener但不兼容attachEvent

    6、弹出窗体在IE9和IE8中不居中

      通过调试发现,在“autoPos”函数中两次返回的X值竟然不一样,具体为什么也没有深入研究:

      

      解决方案:定义一个全局变量leftW

      

      

  • 相关阅读:
    macOS 修改键盘重复按键延迟
    stdout 与 stderr 区别
    E. 1-Trees and Queries
    Codeforces Round #615 (Div. 3)
    Codeforces Round 613(div 2)
    Codeforces Edu80
    SPOJ
    快读
    《货车运输》题解--最大生成树&倍增
    倍增思想求lca
  • 原文地址:https://www.cnblogs.com/tianboblog/p/4025676.html
Copyright © 2011-2022 走看看