// two methods of acquisitionfunctiongetquerystring (parameter) {varReg =NewRegExp ("(^|&)" + parameter + "= ([^&]*) (&|$)"); varr = Window.location.search.substr (1). Match (REG); if(r! =NULL) { if(parameter = = "Deid") { $("#deId"). Val (r[2]); } if(parameter = = "Dename") { $("#deName"). Val (decodeURI (r[2));//solve Chinese garbled characters } }}functiongetrequest () {varurl = location.search;//gets the URL in the "?" String after the character varTherequest =NewObject (); if(Url.indexof ("?")! =-1) { varstr = URL.SUBSTR (1); varSTRs = Str.split ("&"); for(vari = 0; i < strs.length; i++) {Therequest[strs[i].split ("=") [0]] = decodeuricomponent (strs[i].split ("=") [1]); } } returntherequest;}//If the fetch is garbled please see if unescape is used to decode the URL parameters, replace with decodeuricomponent or decodeURI, unescape and escape are about to be discarded// In addition: encodeURIComponent or encodeURI encoding is the same, for the entire URL, the former will be encoded in the URL;/?: @ & = + $, # The latter does not encode
JS get url parameter, and Chinese garbled problem