Used to dynamically add an event after the handler function can dynamically add other processing functions when the mouse clicks __ function

Source: Internet
Author: User

If you need to trigger a lot of functions when you click the mouse, but generally we do not write all directly to the click event, you need to dynamically add the function according to the situation
Before using a listener to add
The following methods in addition to the implementation of the above functional code more concise, transfer parameters more powerful

Used to dynamically add an event after the handler function//loop traversal event Post handler function//funnames--specifies functions that need to be performed function event (args, Funnames) {for (var i in _eventafter) {if Typ EOF (_eventafter[i]) = = "function" && funnames.indexof (i) >= 0) {_eventafter[i] (args);} }//Event-processed var _eventafter = new Eventafter (); function Eventafter (Outargs) {//external parameters are brought into the This.args////can be used internally by the positive external definition of internal parameters for the purpose of course you can add additional parameters by itself}//define functions in the Post handler function _ Eventafter.args = ' _eventafterargs '; _eventafter.afun = function (outarg) {alert (_eventafter.args + "" + Outarg);} Excite Event Events (' _eventafteroutarg ', ' afun ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.