Recently, I have been busy working on the projects at hand, and I have just come into contact with easyui. It gives me a good overall feeling, which is simple and convenient, and is suitable for beginners.
Originally, it was JavaScript and finally connected to the UI. All the people in CSS took over the work and lamented the hard work of technology under the people who do not know the technology. A simple sentence sounds very high. It is actually sb. I would like to advise you not to insult the technology if you do not understand the technology!
Now, let's get down to the truth!
Easyui basic syntax of the official website has a very detailed introduction, here do not say, For details, please refer to: http://www.jeasyui.com/
I 'd like to talk about some of the most useful ones.
1. easyui Regular Expression verification. The result is good. Unfortunately, the error message is too ugly ~~
$. Extend ($. FN. validatebox. defaults. Rules ,{
Idcard: {// verify the ID card
Validator: function (value ){
Return/^ \ D {15} (\ D {2} [A-Za-z0-9])? $/I. Test (value );
},
Message: 'incorrect ID card number format'
},
Minlength :{
Validator: function (value, Param ){
Return Value. length> = Param [0];
},
Message: 'enter at least (2) characters .'
},
Length: {validator: function (value, Param ){
VaR Len = $. Trim (value). length;
Return Len> = Param [0] & Len <= Param [1];
},
Message: "The length of the input content must be between {0} and {1 ."
},
Phone: {// verify the phone number
Validator: function (value ){
Return/^ (\ D {2, 3} \) | (\ D {3 }\-))? (\ (0 \ D {2, 3} \) | 0 \ D {2, 3 }-)? [1-9] \ D {6, 7} (\-\ D {1, 4 })? $/I. Test (value );
},
Message: 'format is incorrect. Please use the following format: 020-888888888888'
},
Mobile: {// verify the mobile phone number
Validator: function (value ){
Return/^ (13 | 15 | 18) \ D {9} $/I. Test (value );
},
Message: 'incorrect Mobile Phone Number Format'
},
Intorfloat: {// verify the integer or decimal number
Validator: function (value ){
Return/^ \ D + (\. \ D + )? $/I. Test (value );
},
Message: 'enter a number and make sure the format is correct'
},
Currency: {// verify currency
Validator: function (value ){
Return/^ \ D + (\. \ D + )? $/I. Test (value );
},
Message: 'invalid currency format'
},
QQ: {// verify QQ, from 10000
Validator: function (value ){
Return/^ [1-9] \ D {4, 9} $/I. Test (value );
},
Message: 'incorrect QQ number format'
},
Integer: {// verification integer
Validator: function (value ){
Return/^ [+]? [1-9] + \ D * $/I. Test (value );
},
Message: 'enter an integer'
},
Age: {// verification age
Validator: function (value ){
Return/^ (? : [1-9] [0-9]? | 1 [01] [0-9] | 120) $/I. Test (value );
},
Message: 'Age must be an integer between 0 and 120'
},
Chinese: {// verify Chinese
Validator: function (value ){
Return/^ [\ response-\ ¥] + $/I. Test (value );
},
Message: 'enter Chinese characters'
},
English: {// verify English
Validator: function (value ){
Return/^ [A-Za-Z] + $/I. Test (value );
},
Message: 'enter English'
},
Unnormal: {// verify whether the string contains spaces and invalid characters
Validator: function (value ){
Return/. +/I. Test (value );
},
Message: 'The input value cannot be blank or contain other illegal characters'
},
Username: {// verify the user name
Validator: function (value ){
Return/^ [A-Za-Z] [a-zA-Z0-9 _] {5, 15} $/I. Test (value );
},
Message: 'invalid User Name (starting with a letter, 6-16 bytes allowed, with letters, numbers, and underscores allowed )'
},
Faxno: {// verify the fax
Validator: function (value ){
// Return/^ [+] {0, 1} (\ D) {1, 3} []? ([-]? (\ D) | []) {1, 12}) + $/I. Test (value );
Return/^ (\ D {2, 3} \) | (\ D {3 }\-))? (\ (0 \ D {2, 3} \) | 0 \ D {2, 3 }-)? [1-9] \ D {6, 7} (\-\ D {1, 4 })? $/I. Test (value );
},
Message: 'incorrect Fax number'
},
ZIP: {// verify the zip code
Validator: function (value ){
Return/^ [1-9] \ D {5} $/I. Test (value );
},
Message: 'incorrect zip code format'
},
IP: {// verify the IP address
Validator: function (value ){
Return/d +. d +/I. Test (value );
},
Message: 'incorrect IP address format'
},
Name: {// verification name, which can be Chinese or English
Validator: function (value ){
Return/^ [\ response-\ ¥] + $/I. test (value) |/^ \ W + [\ W \ s] + \ W + $/I. test (value );
},
Message: 'enter your name'
},
Date: {// verification name, which can be Chinese or English
Validator: function (value ){
// The format is yyyy-mm-dd Or yyyy-m-D.
Return/^ (? :(?! (0000) [0-9] {4} ([-]?) (? :(? : 0? [1-9] | 1 [0-2]) \ 1 (? : 0? [1-9] | 1 [0-9] | 2 [0-8]) | (? : 0? [13-9] | 1 [0-2]) \ 1 (? : 29 | 30) | (? : 0? [1, 13578] | 1 [02]) \ 1 (? : 31) | (? : [0-9] {2 }(? : 0 [48] | [2468] [048] | [13579] [26]) | (? : 0 [48] | [2468] [048] | [13579] [26]) 00) ([-]?) 0? 2 \ 2 (? : 29) $/I. Test (value );
},
Message: 'enter an appropriate date format'
},
MSN :{
Validator: function (value ){
Return/^ \ W + ([-+.] \ W +) * @ \ W + ([-.] \ W + )*\. \ W + ([-.] \ W +) * $ /. test (value );
},
Message: 'enter a valid MSN account (e.g. ABC @ hotnail (MSN/live). com )'
},
Same :{
Validator: function (value, Param ){
If ($ ("#" + Param [0]). Val ()! = "" & Value! = ""){
Return $ ("#" + Param [0]). Val () = value;
} Else {
Return true;
}
},
Message: 'The passwords entered twice are inconsistent! '
}
2. easyui style Adjustment
/** Table input Style
*
*
$ ("# Tab input" detail .css ({
'Width': '100px ;',
'Height': '25px ;',
'Line-height': '20px'
});
/** Table panel Style
*
*
$ ("# Tab"). Panel ({
Title: 'query 'width: 100, height: 100, iconcls: 'icon-search', nowrap: True, collarpsible: false, remotesort: false });