<html>
<head>
<title>手动添加删除事件</title>
<script language="javascript">
var a;
var a;
function aEvent() {
var oBtn = document.all['oBtn'];
oBtn.attachEvent('onclick', sText);
}
function dEvent() {
var oBtn = document.all['oBtn'];
oBtn.detachEvent('onclick', sText);
}
function sText() {
window.alert('看到效果了吗^^');
}
</script>
</head>
<body>
<button id="oBtn">点击我查看效果</button>
<button οnclick="aEvent();">添加事件</button>
<button οnclick="dEvent();">取消事件</button>
<br >
</body>
</html>