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