日期:2014-05-16 浏览次数:20430 次
function addEvent(elem,evtType,func){ if(elem.addEventListener){ elem.addEvenListerner(evtType,func,false); }else if(elem.attachEvent) { elem.attachEvent("on" + evtType,func); }else{ elem["on" + evtType] = func; } }
function addstyle(){ ...//代码块 } addEvent(window,"load",function(){//当网页完全加载成功后,为submit按钮添加一点点击触发事件,执行函数addstyle() addEvent(document.getElementByIdx_x("addint"),"click",addstyle); });
<input type="submit" id="addint" />