Recently, I am working on projects for my mentor, and I am also officially studying web. I was wondering how to make something separate.ArticleBut some are my own summary, and some are nice to see others.Code. Therefore, all the "One Pot" methods are put here, and all the new things are posted here to facilitate future queries.
1. getparameter in JS
1) Take a parameter
VaR paramter_value = NULL; <br/> function getparameter (paramname) {<br/> If (! Paramter_value) {// The first initialization <br/> paramter_value = new array (); <br/> var paramstr = location. search. substring (1); <br/> var paramarr = paramstr. split ("&"); <br/> var Len = paramarr. length; <br/> var temparr; <br/> for (VAR I = 0; I <Len; I ++) {<br/> temparr = paramarr [I]. split ("="); <br/> paramter_value [temparr [0] = temparr [1]; <br/>}< br/> var paramvalue = paramter_value [paramname]; <br/> If (paramvalue) {<br/> return paramvalue; <br/>}< br/>}
2) multiple parameters
function getparameter (name) {<br/> var regexs = "[//? &] "+ Name +" = ([^ & #] *) "; <br/> var RegEx = new Regexp (regexs); <br/> var tmpurl = Window. location. href; <br/> var Results = regex.exe C (tmpurl); <br/> If (Results = NULL) <br/> return ""; <br/> else <br/> return results [1]; <br/>}