关于解除事件绑定 我发现js中的removeEventListener或者detachEvent只对attach上去的事件有用jquery的unbind好像也只对bind上去的事件有效果如果是直接写在html标签里的的事件不能解除,这个怎么办? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 比如你对一个div写了onclick=function....那么就 document.getElementById('div的id').onclick=null; onclick=null在ff下不行,ie6下是可以的 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> </head> <body> <div id="test">Click Me!</div> <script type="text/javascript"> //<![CDATA[ document.getElementById('test').onclick=function(){ alert(this.innerHTML); }; document.getElementById('test').onclick=undefined || null; //]]> </script> </body></html> 帮忙调整下效果 如何修改可以让jRating重复选择? 请问jquery 的 WYMeditor怎么使用啊 如何实现字符串中的字符对调? 在HTML中,如何创建定位标记? 请教如何用js来获取客户端计算机所连打印机的类型及其默认的打印机名称? 关于div播放 IE设置问题!!——在线等待:) SOS~!!!!! 请教各位怎样在B/S环境下使用JavaScript和Applet交互实现Web打印 关于innerHTML中添加<a onclick>事件问题 javascript如何实现一个table中的单元格变成文本框
那么就 document.getElementById('div的id').onclick=null;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head> <body>
<div id="test">Click Me!</div>
<script type="text/javascript">
//<![CDATA[
document.getElementById('test').onclick=function(){
alert(this.innerHTML);
};
document.getElementById('test').onclick=undefined || null;
//]]>
</script>
</body>
</html>