javascriptieff自动添加事件
script type="text/javascript" function addEventHandler(target, type, func) { if (target.addEventListener) target.addEventListener(type, func, false); else if (target.attachEvent) target.attachEvent("on" + type, func); else target["on" + ty
function removeEventHandler(target, type, func) {
if (target.removeEventListener)
target.removeEventListener(type, func, false);
else if (target.detachEvent)
target.detachEvent("on" + type, func);
else delete target["on" + type];
}
var Button1 = document.getElementById("Button1");
var Button1Click = function() { alert(1); };
addEventHandler(Button1, "click", Button1Click);
addEventHandler(Button1, "click", function() { alert(2); } );
addEventHandler(Button1, "click", function() { alert(3); } );
//removeEventHandler(Button1, "click", function() { alert(2); } );
//removeEventHandler(Button1, "click", Button1Click);
上一篇: C#如何使用浏览按钮获得文件路径和文件夹路径的实现方法
下一篇: 不想php文件被单独浏览怎么处理