87,955
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
<body>
<div id="two">hei</div>
</body>
<script>
window.onload = function()
{
var di = document.getElementById("two");
di.onclik = function(){
alert("hello");
document.write("别碰我")
}
}
</script>
<body>
<div id="two">hei</div>
</body>
<script>
window.onload = function()
{
var di = document.getElementById("two");
di.click(function(){
alert("hello");
document.write("别碰我")
})
}
</script>
你试试这样写应该就可以了