js控制onclick事件实例
<html><head> </head><body><button id="a1">点击</button><script>function test(){document.getElementById("a1").onclick=function(){alert('this is a1');};//下面这种写法是不对的//document.getElementById("a1").onclick="alert('this is a1');";}test();</script></body></html>?
?