Home >Web Front-end >JS Tutorial >Use JavaScript to modify the method executed by the onclick event in the component
In the past, I often encountered a situation in projects where clicking on the same html component would execute different methods or functions. So I wrote the following method myself, which is relatively stupid, but still executable.
The core code is as follows:
1. . * Created by: FrancisRan
6. * Created time: 2010-07-30
7. * Last modified time: 2010-07-30
8. .com
9. */
10. tTest" ; alert("Modify The last onclick: nn" + document.getElementById("eventTest").onclick); // Modified event
28. function alertEvent2 () {
29. alert("This is an event triggered after deletion"); script>
33.
34.
35.