用于<a>标签删除确认,防止误删
<a href="http://www.cnblogs.com/zixueit/">百度</a>
<script type="text/javascript">
var a = document.getElementsByTagName('a')[0];
var href = a.href;
a.onclick = function (){
a.href="javascript:void(0);";
if(!confirm('确定?')){
return false;
}else{
this.href = href;
}
}
</script>
上面是dom0级事件绑定,dom2级绑定参考:http://www.cnblogs.com/zixueit/p/3844864.html#solution