10. cache ??? Dialog
The dialog displayed in window. showmodaldialog is Refresh. With the cache mechanism added, the modified front-end code will not be updated even if it is updated,
Coding is troublesome. When you use it, you feel that it has no major impact, unless it is used in special cases.
Therefore, it is said that adding & __ = new date () to the URL can solve the problem.
11. Focus () & blur ()
Be careful when writing code. The Details determine success or failure. From lower-level feedback to upper-level response to lower-level execution,
It may take a long time to determine a feature. Because everyone is afraid of trouble, they still decided to use alert () N years ago for validate.
Careless I used jquery's Blur () and focus () to check n. I don't know where the error is. When the event fails, a function is triggered,
If the condition is not met, perform alert (); forcus (). I also wrote a forcus () in the condition judgment. When it is finished, alert () is popped up wirelessly ();
Dead. When using this function, the logic must be clear. But this is also a malicious code...
12. In jquery $ ("title" ).html ("XXX"), unexpected call to method or property access will appear in IE.
This is mainly because of the append () method. It uses getdocumentbytagname (), and uses methods such as innerhtml to add or
This problem occurs when you modify the content of the title.
It is clear that JavaScript has a document. Title method. Alas, just use it directly.
Thanks to netbeans's good support for Javascript, code completion, especially the explanation and demo on the code prompt. I was touched.
Poor infrastructure and poor memory I am here. Sun was acquired. I don't know what would happen to netbeans. I'm sad...
13. use regular expressions in Javascript-Common Code Verification
// Http://docs.jquery.com/Plugins/Validation/Methods/minlength
Minlength: function (value, element, Param ){
Return this. Optional (element) | this. getlength ($. Trim (value), element)> = Param;
},
// Http://docs.jquery.com/Plugins/Validation/Methods/maxlength
Maxlength: function (value, element, Param ){
Return this. Optional (element) | this. getlength ($. Trim (value), element) <= Param;
},
// Http://docs.jquery.com/Plugins/Validation/Methods/rangelength
Rangelength: function (value, element, Param ){
VaR length = This. getlength ($. Trim (value), element );
Return this. Optional (element) | (length> = Param [0] & length <= Param [1]);
},
// Http://docs.jquery.com/Plugins/Validation/Methods/min
Min: function (value, element, Param ){
Return this. Optional (element) | value> = Param;
},
// Http://docs.jquery.com/Plugins/Validation/Methods/max
MAX: function (value, element, Param ){
Return this. Optional (element) | value <= Param;
},
// Http://docs.jquery.com/Plugins/Validation/Methods/range
Range: function (value, element, Param ){
Return this. Optional (element) | (value> = Param [0] & value <= Param [1]);
},
// Http://docs.jquery.com/Plugins/Validation/Methods/email
Email: function (value, element ){
// Contributed by Scott gonzarez: http://projects.scottsplayground.com/email_address_validation/
Return this. Optional (element) |
/^ ([A-Z] |/d | [! #/$ % & '/*/+/-// = /? /^ _ '{/|} ~] | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) + (/. ([A-Z] |/d | [! #/$ % & '/*/+/-// = /? /^ _ '{/|} ~] | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) +) * | (/x22) (/x20 |/x09) * (/x0d/x0a ))? (/X20 |/x09) + )? ([/X01-/x08/x0b/x0c/x0e-/x1f/x7f] |/X21 | [/x23-/x5b] | [/x5d-/x7e] | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | (// ([/x01-/x09/x0b/x0c/x0d-/x7f] | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) ))) * (/x20 |/x09) * (/x0d/x0a ))? (/X20 |/x09) + )? (/X22) @ ([A-Z] |/d | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | ([A-Z] |/d | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) ([A-Z] |/d |-| /. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) * ([A-Z] |/d | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef])/. + ([A-Z] | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | ([A-Z] | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) ([A-Z] |/d |-| /. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) * ([A-Z] | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef])/.? $/I. Test (value );
},
// Http://docs.jquery.com/Plugins/Validation/Methods/url
URL: function (value, element ){
// Contributed by Scott gonzarez: http://projects.scottsplayground.com/iri/
Return this. Optional (element) |
/^ (HTTPS? | FTP): // ([A-Z] |/d |-|/. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | (% [/DA-F] {2}) | [! /$ & '/(/)/*/+,; =] | :)*@)? (/D | [1-9]/d | 1/D/d | 2 [0-4]/d | 25 [0-5])/. (/d | [1-9]/d | 1/D/d | 2 [0-4]/d | 25 [0-5])/. (/d | [1-9]/d | 1/D/d | 2 [0-4]/d | 25 [0-5])/. (/d | [1-9]/d | 1/D/d | 2 [0-4]/d | 25 [0-5]) | ([A-Z] |/d | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | ([A-Z] |/d | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) ([A-Z] |/d |-| /. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) * ([A-Z] |/d | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef])/. + ([A-Z] | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | ([A-Z] | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) ([A-Z] |/d |-| /. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) * ([A-Z] | [/u00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef])/.?) (:/D *)?) (// ([A-Z] |/d |-|/. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | (% [/DA-F] {2}) | [! /$ & '/(/)/*/+,; =] |: | @) + (// ([A-Z] |/d |-| /. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | (% [/DA-F] {2}) | [! /$ & '/(/)/*/+,; =] |: | @)*)*)?)? (/? ([A-Z] |/d |-|/. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | (% [/DA-F] {2}) | [! /$ & '/(/)/*/+,; =] |: | @) | [/Ue000-/uf8ff] | // | /?) *)? (/# ([A-Z] |/d |-|/. | _ | ~ | [/U00a0-/ud7ff/uf900-/ufdcf/ufdf0-/uffef]) | (% [/DA-F] {2}) | [! /$ & '/(/)/*/+,; =] |: | @) | // | /?) *)? $/I. Test (value );
},
// Http://docs.jquery.com/Plugins/Validation/Methods/date
Date: function (value, element ){
Return this. Optional (element) |! /Invalid | NaN/. Test (new date (value ));
},
// Http://docs.jquery.com/Plugins/Validation/Methods/dateISO
Dateiso: function (value, element ){
Return this. optional (element) |/^/d {4} [//-]/d {1, 2} [//-]/d {1, 2} $ /. test (value );
},
// Http://docs.jquery.com/Plugins/Validation/Methods/dateDE
Datede: function (value, element ){
Return this. Optional (element) |/^/D? /./D? /./D? /D? $/. Test (value );
},
// Http://docs.jquery.com/Plugins/Validation/Methods/number
Number: function (value, element ){
Return this. Optional (element) |/^ -? (? :/D + |/d {1, 3 }(? :,/D {3}) + )(? : //./D + )? $/. Test (value );
},
// Http://docs.jquery.com/Plugins/Validation/Methods/numberDE
Numberde: function (value, element ){
Return this. Optional (element) |/^ -? (? :/D + |/d {1, 3 }(? : // D {3}) + )(? :,/D + )? $/. Test (value );
},
// Http://docs.jquery.com/Plugins/Validation/Methods/digits
Digits: function (value, element ){
Return this. Optional (element) |/^/d + $/. Test (value );
},
// Http://docs.jquery.com/Plugins/Validation/Methods/creditcard
// Based on http://en.wikipedia.org/wiki/Luhn
Creditcard: function (value, element ){
If (this. Optional (element ))
Return "dependency-mismatch ";
// Accept only digits and dashes
If (/[^ 0-] +/. Test (value ))
Return false;
VaR ncheck = 0,
Ndigit = 0,
Beven = false;
Value = value. Replace (// D/g ,"");
For (n = value. Length-1; n> = 0; n --){
VaR cdigit = value. charat (N );
VaR ndigit = parseint (cdigit, 10 );
If (Beven ){
If (ndigit * = 2)> 9)
Ndigit-= 9;
}
Ncheck + = ndigit;
Beven =! Beven;
}
Return (ncheck % 10) = 0;
},
// Http://docs.jquery.com/Plugins/Validation/Methods/accept
Accept: function (value, element, Param ){
Param = typeof Param = "string "? Param. Replace (/,/g, '|'): "PNG | jpe? G | GIF ";
Return this. Optional (element) | value. Match (New Regexp (". (" + Param + ") $", "I "));
},
// Http://docs.jquery.com/Plugins/Validation/Methods/equalTo
Failed to: function (value, element, Param ){
Return Value = $ (PARAM). Val ();
}