How to disable the onload event while the page is running and invalidate an event.

* * I have an object that is unclickable in the previous stage of the page, and something else happens when I click on it in the next stage.

I wrote two onclick methods on this object that run when the page onload. The second one overrides the first method1 method with the method2 method, which is expected to happen.

now I need to run the first method1. It makes sense for me to remove the second method and run it. The question is: what method should I use to remove the method2 method? * *

window.onload=function(){
     method1();
     method2();
}
function method1(){
var object=document.getElementById(object); //method2
   object.onclick=function(){
     console.log("OK");
  }
}
function method2(){
var object=document.getElementById(object);
   object.onclick=function(){
     alert("disable");
  }
}
Mar.18,2021

objecthandler
addEventLinstener;

,
1method2,1click

1method1;
2method2
  • How can this effect be achieved?

    I would like to ask how to achieve this effect, QQ chat why sometimes send a link is the first form, sometimes a link is the second form? : : http: tieba.baidu.com p 3746... qq there is a corresponding relationship between the above two parts....

    Mar.14,2021
Menu