An overview of several simple logic questions

Source: Internet
Author: User

# # # # # # # # # # # # # # # # # # # in the process of using MINIUI, there are some common logic issues

1 table validation numbers greater than 200 are shown in green and less than 200 are shown in red. The MINIUI is used.

Add the Drawcell property to the DataGrid

Mini.parse (); varGrid = Mini.get ("DataGrid1"); Grid.load ();//The following is the added code, which is initializedGrid.on ("Drawcell",function(e) {varRecord =E.record, Field=E.field, Value=E.value; if(field = "Money" && value >= 100) E.cellstyle= "Color:green"; Else if(Field = = "Money" && value < 100) E.cellstyle= "Color:red"; });

2 simple procedures for judging credit card overdraft (primary overdraft 1000, intermediate overdraft 5000, advanced overdraft 10000)

        functiononcheckvalidation () {Overmoney= Money – (Mini.getbyname ("Price")). GetValue ()); if(overmoney>=0)return true; Else {                Switch(Standard) { Case"1":                        if(Math.Abs (Overmoney) <= 1000)return true; Else return false;  Break;  Case"2":                        if(Math.Abs (Overmoney) <= 5000)return true; Else return false;  Break;  Case"3":                        if(Math.Abs (Overmoney) <= 10000)return true; Else return false;  Break; default:                        return false;  Break; }            }        }

3 Verifying the identity card

        function Onidcardsvalidation (e) {            if  (e.isvalid) {                var pattern =/^ (^[1-9]\d{7} ( 0\D) | (1[0-2])) (([0|1|2]\d) |3[0-1]) \d{3}$) | (^[1-9]\d{5}[1-9]\d{3} ((0\d) | ( 1[0-2]) (([0|1|2]\d) |3[0-1]) ((\d{4}) |\d{3}[xx]) $) $/;                 if false ) {                    false;                    Mini.alert ("ID card number format is incorrect", "system hint")        ; }}}

4 Verifying the phone number

        function Onphonenumbervalidation (e) {            if  (e.isvalid) {                var pattern =/^ (13[0-9]| 15[012356789]|17[678]|18[0-9]|14[57]) [0-9]{8}$/;                 if false ) {                    false;                    Mini.alert ("cell phone number format is incorrect", "system hint")        ; }}}

5 Check time. Start time and end time. Simple program

        //Check time: The end time cannot be earlier than the start time        functionvali_date () {varStarttimepick = Mini.getbyname ("StartTime"); varEndtimepick = Mini.getbyname ("EndTime"); varStartTime =Starttimepick.getvalue (); varEndTime =Endtimepick.getvalue (); if(StartTime >endTime) {                return false; }            return true; }

6 Receiving background exception information

$.ajax ({URL:"Data/ajaxsalaryinfo.aspx?method=savesalaryinfo", type:' Post ', data: {Data:json}, cache:false, Success:function(text) {Debugger; if(Mini.decode (text). Mess = = "violation of UNIQUE KEY constraint") {Mini.alert ("The employee has recorded this month!" "," System Prompt "); }                    ElseCloseWindow ("Save"); }, Error:function(JQXHR, Textstatus, Errorthrown) {alert (jqxhr.responsetext);                CloseWindow (); }            });

An overview of several simple logic questions

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.