Home  >  Article  >  Web Front-end  >  Use JavaScript to modify the method executed by the onclick event in the component

Use JavaScript to modify the method executed by the onclick event in the component

高洛峰
高洛峰Original
2016-11-25 14:03:571202browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:JavaScript fast chargingNext article:JavaScript fast charging