我不知道如何找到该行,但是通过以下代码您可以找到哪个函数添加了事件。
首先给元素添加一个id,比如myid
在元素之后添加此脚本:
var el=document.getElementById('myid');
el.oldAddEvent=el.addEventListener;
el.addEventListener=function f(a,b,c){
if(a=='click'){
alert((f.caller?f.caller+"\n\n":"Window ")+"has added a click event to\n\n"+b+"\n\nwith eventCapture="+(c?true:false));
}
el.oldAddEvent(a,b,c);
}
那么,如果有这样的脚本......
<script>
el.addEventListener('click',f,false);
</script>
...它会提醒
Window has added a click event to
function f() {
alert("click");
}
with eventCapture=false
有了这个...
function g(){
el.addEventListener('click',f,false);
}
g();
...它会提醒
function g() {
el.addEventListener("click", f, false);
}
has added a click event to
function f() {
alert("click");
}
with eventCapture=false