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;
};

时间: 2024-10-01 02:51:35

Formatting the event object的相关文章

VBA学习笔记(9)-Shape Object Members

Shape Object Members Represents anything you can select in a drawing window: a basic shape, a group, a guide, or an object from another application embedded or linked in Microsoft Office Visio. Methods   Name Description   AddGuide Adds a guide to a

VBA学习笔记(8)-Application Object Members

Application Object Members Represents an instance of Microsoft Office Visio. An external program typically creates or retrieves an Application object before it can retrieve other Visio objects from that instance. Use the Microsoft Visual Basic Create

线程同步之EVENT

事件可传信给其他线程,表示某些条件现在已具备,比如有可用的消息. 事件可分为手动复位和自动复位,前者可传信给许多同时等待事件的线程而且可以被复位. 自动复位的事件传信给单个等待时间的线程,该事件会自动复位. Applications can use event objects in a number of situations to notify a waiting thread of the occurrence of an event. For example, overlapped I/O

Document Object Model (DOM) Level 3 Events Specification

Document Object Model (DOM) Level 3 Events Specification W3C Working Draft 25 September 2014 This version: http://www.w3.org/TR/2014/WD-DOM-Level-3-Events-20140925/ Latest published version: http://www.w3.org/TR/DOM-Level-3-Events/ Latest editor's dr

[转]同步对象Event的用法

同步对象Event的用法  首先介绍CreateEvent是创建windows事件的意思,作用主要用在判断线程退出,线程锁定方面.  CreateEvent函数功能描述:创建或打开一个命名的或无名的事件对象.  EVENT有两种状态:发信号,不发信号.   SetEvent/ResetEvent分别将EVENT置为这两种状态分别是发信号与不发信号.   WaitForSingleObject()等待(阻塞),直到参数所指定的OBJECT成为发信号状态时才返回,OBJECT可以是EVENT,也可以

trigger()的event事件对象之坑

问题引入,先贴一段有问题的代码,如果你对 trigger()  这个函数了解不透彻,还真看不出这段代码错在哪.完成的功能是样式转换器,想让页面在加载后自行触发点击事件隐藏三个按钮,但是效果如图并没有隐藏按钮们:控制台会报错: target  属性是 undefined ,肯定是 event 这个事件对象没获取到的问题,程序到17行出错停止,这让我感到疑问:自定义触发的事件难道没有event对象吗?. 1 <div id="switcher" class="switche

Yii2的深入学习--yii\base\Event 类

根据之前一篇文章,我们知道 Yii2 的事件分两类,一是类级别的事件,二是实例级别的事件.类级别的事件是基于 yii\base\Event 实现,实例级别的事件是基于 yii\base\Component 实现. 今天先来看下类级别事件的实现,代码是 yii\base\Event 类. <?php namespace yii\base; /** * Event is the base class for all event classes. */ class Event extends Obje

nova libvirt event

nova中利用libvirt 事件来更新vm的DB中的power状态 https://wiki.openstack.org/wiki/ComputeDriverEvents Nova compute manager每10分钟报告hypervisor上VM的状态,可以让nova检测到vm的真实状态,比如vm被guest OS shutdown或者被Hyper kill掉了. _sync_power_states,虚拟机状态刷新,spacing=600获取db中本机上的虚拟机,(会调用driver的

VBA学习笔记(10)-Cell Object Members

Cell Object Members Holds a formula that evaluates to some value. Methods   Name Description   GlueTo Glues one shape to another, from a cell in the first shape to a cell in the second shape.   GlueToPos Glues one shape to another from a cell in the