JSON 封装函数
var eventUtil = { addHandler:function(element,type,handler) { //添加句柄 if(element.addEventListener) { element.addEventLisetener(type,handler,false); }else if(element.atachEvent) { element.atachEvent('on' + type + handler); }else { element['on' + type] = handler; } }, removeHandler:function(element,type,handler) { //删除句柄 if(element.removeEventListener) { element.removeEventLisetener(type,handler,false); }else if(element.detachEvent) { element.detachEvent('on' + type + handler); }else { element['on' + type] = null; } }, getEvent:function(event) { //获取事件 return event?event:window.event; }, getType:function(event) { //获取类型 return event.type; }, getElement:function(event) { //获取元素目标 return event.target || event.srcElement; }, preventDefault:function (event) { //阻止默认事件 if(event.preventDefault) { event.preventDefault(); }else { event.returnValue = false; } }, stopPropagation:function(event) { //阻止事件冒泡 if(event.stopPropagation) { vent.stopPropagation(); }else { event.cancelBubble = true; } } }