日期:2014-05-16 浏览次数:20527 次
<li>load</li> <li>unload</li> <li>select</li> <li>change</li> <li>submit</li> <li>reset</li> <li>resize</li> <li>scroll</li>,MouseEvents包括
* <li>click</li> * <li>dblclick</li> * <li>mousedown</li> * <li>mouseup</li> * <li>mouseover</li> * <li>mousemove</li> * <li>mouseout</li>,UIEvents包括
* <li>focusin</li> * <li>focusout</li> * <li>activate</li> * <li>focus</li> * <li>blur</li>。
createHtmlEvent: function (doc, type, bubbles, cancelable) { var event = doc.createEvent('HTMLEvents'); event.initEvent(type, bubbles, cancelable); return event; },
createMouseEvent: function (doc, type, bubbles, cancelable, detail, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget) { var event = doc.createEvent('MouseEvents'), view = doc.defaultView || window; if (event.initMouseEvent) { event.initMouseEvent(type, bubbles, cancelable, view, detail, clientX, clientY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget); } else { // old Safari event = doc.createEvent('UIEvents'); event.initEvent(type, bubbles, cancelable); event.view = view; event.detail = detail; event.screenX = clientX; event.screenY = clientY; event.clientX = clientX; event.clientY = clientY; event.ctrlKey = ctrlKey; event.altKey = altKey; event.metaKey = metaKey; event.shiftKey = shiftKey; event.button = button; event.relatedTarget = relatedTarget; } return event; },
createUIEvent: function (doc, type, bubbles, cancelable, detail) { var event = doc.createEvent('UIEvents'), view = doc.defaultView || window; event.initUIEvent(type, bubbles, cancelable, view, detail); return event; }
fireEvent: function (target, type, event) { target.dispatchEvent(event); }
createHtmlEvent: function (doc, type, bubbles, cancelable) { var event = doc.createEventObject(); event.bubbles = bubbles; event.cancelable = cancelable; return event; }, createMouseEvent: function (doc, type, bubbles, cancelable, detail, clientX, clientY, ctrlK