正则 清除 onXXX 事件
正则 清除 onXXX 事件
<p id= "my " onclick= "alert( 'd ') " onmousemove= "alert( 'd ') " title= "ddddd ">
必须匹配标签里的 onXXX 事件,把他们删除
------解决方案-------------------- <textarea id= "textarea1 ">
<p id= "my " onclick= "alert( 'd ') " onmousemove= "alert( 'd ') " title= "ddddd ">
</textarea>
<script langauge=javascript>
var str=document.getElementById( "textarea1 ").value
re=/\son[^\s> ]*/g
alert(str.replace(re, " "))
</script>