Js Custom Event code Description

Source: Internet
Author: User

Copy codeThe Code is as follows:
<Form onreturn = "ReturnCallBack ();" jstype = "vali">
</Form>
<Script type = "text/javascript">
Var ReturnCallBack = function (){
// CODE
Return true;
}
</Script>

The code looks too suspended. Why does it look like an onreturn event is added...

Let me talk about one reason for this. in the Framework, I did what I should do in the verification API, but there are some things that often need to change, such as verifying whether a checkbox can be selected, it is necessary to verify the situation based on different situations. These situations also change frequently and how the market needs to change. Therefore, I will return the jobs that check whether checkbox can select this type of change to the developers of the current project. I will only do what I should do.

For example, I will provide the form with an onreturn event, let others write the verification by themselves, and return true or false to me.

In the form of custom attributes, let others add and do some technical work. I used eval (). after verification is performed in the framework, I will execute the following sentence.
Copy codeThe Code is as follows:
// Verify the CODE...
Var ele = $ (this); // this is the form, which is developed by jquery.
Var result = eval (ele. attr ("onreturn "));
// CODE ..

Related Article

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.