Custom functions
/*-----------------Achieve 1--------------------*/functionGetpar (PAR) {//Get current URL varLocal_url =Document.location.href; //gets the get parameter position to get varget = Local_url.indexof (par + "="); if(Get = =-1){ return false; } //Intercept String varGet_par = Local_url.slice (par.length + get + 1); //determine if the truncated string has other get parameters varNextpar = Get_par.indexof ("&"); if(Nextpar! =-1) {Get_par= Get_par.slice (0, Nextpar); } returnGet_par;} /*--------------------Implementation 2 (Return $_get object, imitation php mode)----------------------*/var$_get = (function(){ varURL =window.document.location.href.toString (); varU = Url.split ("?")); if(typeof(u[1]) = = "string") {u= U[1].split ("&"); varget = {}; for(varIinchu) { varj = U[i].split ("="); get[j[0]] = j[1]; } returnget; } Else { return {}; }})(); /*The 2nd way, when used, can directly $_get[' get parameters ', directly get the value of the Get parameter*/
JS Get Get Parameters