JS supplement - regular and commonly used style library

A, Bootstrap-- recommended!
Bootstrap4 is currently the latest version of Bootstrap, is a set of open source tools for HTML, CSS and JS development. Sass use variables and we offer a lot of mixin, responsive grid system, scalable prefabricated components, powerful jQuery based plugin system, to quickly develop a prototype for your ideas or to build the entire app.


Two, jQuery UI-- nudge. .
jQuery UI is built on the jQuery JavaScript library a set of user interface interactions, effects, widgets and themes. Whether you are creating highly interactive Web applications or just add a date picker to form controls, jQuery UI is a perfect choice.
jQuery UI contains many small parts to maintain the state (the Widget), and therefore, it is typical to use jQuery plug slightly different patterns. Use the same pattern all the jQuery UI widgets (Widget), so long as you learn how to use one, you'll know how to use other widgets (Widget).


Three, jQuery Easy UI-- contains a lot of JS defined elements, modify, and calls particularly complex
jQuery EasyUI is a jQuery-based framework, and integrates a variety of user interface plug-ins.


Fourth, regular:

   
    ** 1, RegExp object methods: **
        regex front, after a string

        RegExp.test (string): string line with regular returns True, does not meet the return False
        RegExp.exec (string): string line with the positive value of the string is returned, otherwise Null, if used (|), returns array.

    // E-mail is detected, the user name can be supported with a point 
    mail_exp = / ^ \ w + \.? \ W + @ \ w + \. \ W + \.? \ W + $ / 
    mail_str1='[email protected] ' // format identification result mail_str1 string 
    mail_str2='[email protected] '// recognition result is not null 
    RESULT1 = mail_exp.exec (mail_str2) 
    document.write (RESULT1) 
    
    // detected phone number, satisfying 11, and beginning with the specified predetermined number 
    mobile_exp = / ^ (138 | 139 | 130. | 131 is) \ {D} $. 8 / 
    mobile_str1 = '13,112,345,678' // format identification result [13112345678,131] array 
    mobile_str2 = ' 18012345678 '// recognition result is not null 
    RESULT1 = mobile_exp.exec (mobile_str2) 
    document.write (RESULT1 [0])

      ** 2, support for regular expressions String object: **      

        starting index search searches for regular expression matching. No match returns -1
        match or find a more regular expression matching result, the matching does not return null, / g the global mode, returns the resulting array.
        Alternatively replace substring matching the regular expression, returns the new replacement string. Unspecified Alternatively, use undefined, use / g global mode, replace all.

        split the string into an array of strings.

    Search // 
    mobile_exp = / \ D + / 
    mobile_str1 = 'dddd2422'      
    mobile_str2 = 'ddddafff'  
    RESULT1 = mobile_str1.search (mobile_exp) // result. 4 
    result2 = mobile_str2.search (mobile_exp) // result is -1 

    // match 
    mobile_exp = / \ + D / G 
    mobile_str1 = 'kkk13112345dd6788'     
    RESULT1 = mobile_str1.match (mobile_exp) // result is [13112345,6788] array 
    mobile_exp2 = / \ D + / 
    result2 = mobile_str1.match (mobile_exp2) // result is 13112345 
    
    / / Replace 
    mobile_exp = / \ + D / G 
    mobile_str1 = 'dddd2422'      
    mobile_str2 = 'ddd123ff456f'  
    RESULT1 = mobile_str1.replace (mobile_exp, 'AAA') // result is ddddaaa 
    mobile_exp2 = / \ + D / G
    result2=mobile_str2.replace(mobile_exp2)   // undefined123undefined456undefined  
    document.write(result2)
    
    //split
    mobile_str2='ddd123ff456f' 
    mobile_exp2=/\D+/
    result2=mobile_str2.split(mobile_exp2)   // [,123,456, ]


      ** 3, RegExp object properties: **     

        constructor property returns an object constructor. The return value is a function reference, not the function name:

                JavaScript regular expression constructor property returns the RegExp function () {[Native code]}
                JavaScript array constructor property returns the Array function () {[Native code]}
                JavaScript Number The number constructor property return function () {[Native code]}
                JavaScript string property returns a constructor returns function String () {[native code]}
                If a variable is an array that you can use to define the constructor property.       

 

        determining whether a global "g" modifier

                Regular expressions .global, returns true or false


        ignoreCase determines whether a "i" modifier

                Regular expressions .ignoreCase, returns true or false


        LastIndex match starting position, the property is only set to use the g flag. = Number assignment, without a number acquisition value =

STR = var "of The Rain in Spain Stays Mainly in The Plain"; 
var = patt1 / AIN / G; 
patt1.lastIndex = 20 is; // change value, lastIndex value becomes the search. 
document.write (patt1.exec (STR)); 
document.write (patt1.lastIndex);

        

        determining whether a multiline "m" modifier, set the return True, otherwise return False

        var patt1 = / RUN / m; return true


        source returns the contents of regular expressions, do not include parameters.

. var patt1 = / \ w + \ {6} / G; 
document.write (patt1.source);. // return \ w + \ {6}



Guess you like

Origin blog.51cto.com/yishi/2432018