zoukankan      html  css  js  c++  java
  • Formatting the event object

    尽量将IE与DOM函数事件对象不同的性质或方法转成DOM标准
     

    EventUtil.formatEvent = function (oEvent) {

       if (isIE && isWin) {                                          //判断IE的方法略
           oEvent.charCode = (oEvent.type == “keypress”) ? oEvent.keyCode : 0;
           oEvent.eventPhase = 2;
           oEvent.isChar = (oEvent.charCode > 0);
           oEvent.pageX = oEvent.clientX + document.body.scrollLeft;
           oEvent.pageY = oEvent.clientY + document.body.scrollTop;

           oEvent.preventDefault = function () {
              this.returnValue = false;
           };

           if (oEvent.type == “mouseout”) {
              oEvent.relatedTarget = oEvent.toElement;
           } else if (oEvent.type == “mouseover”) {
              oEvent.relatedTarget = oEvent.fromElement;
           }

           oEvent.stopPropagation = function () {
              this.cancelBubble = true;
           };

           oEvent.target = oEvent.srcElement;
           oEvent.time = (new Date).getTime();
       }
       return oEvent;
    };
  • 相关阅读:
    JAVA内部类的使用
    JAVA try&&catch
    是时候清除你的僵尸代码了
    修复EXE文件无法打开
    MFC实现播放SWF
    JAVA实现swap
    Java RandomAccessFile用法
    程序员如何做出“不难看”的设计
    JAVA期末考试试题
    java static类
  • 原文地址:https://www.cnblogs.com/chuangweili/p/5159698.html
Copyright © 2011-2022 走看看