//获取样式 function getStyle(obj,attr){ if(obj.currentStyle){ return obj.currentStyle[attr]; }else{ return getComputedStyle(obj)[attr]; } } //绑定事件 function addHandler(element,type,handler){ if(element.addEventListener){ element.addEventListener(type,handler,false); }else if(element.attachEvent){ element.attachEvent("on"+type,handler); }else{ element["on"+type]=handler; } } //取消绑定事件 function removeHandler(element,type,handler){ if(element.removeEventListener){ element.removeEventListener(type,handler,false); }else if(element.detachEvent){ element.detachEvent("on"+type,handler); }else{ element["on"+type]=null; } } function getById(id){ id=id+""; return document.getElementById(id); } function getByClass(obj,className){ var a=new Array; var b=obj.getElementsByTagName("*"); for(var i in b){ if(b[i].className==className){ a.push(b[i]); } } return a; }