Gets the Address bar parameter array function geturlparams () {var search = Window.location.search; Write data dictionary var tmparray = search.substr (1, search.length). Split ("&"); var paramsarray = new Array; if (Tmparray! = null) {for (var i = 0; i < tmparray.length; i++) {var reg =/[=|^==]/; Split with =, but does not include = = var Set1 = tmparray[i].replace (Reg, ' & '); var tmpStr2 = set1.split (' & '); var array = new Array; Array[tmpstr2[0]] = tmpstr2[1]; Paramsarray.push (array); }}//returns the parameter array to return paramsarray; }//Get parameter value according to parameter name function GetParamValue (name) {var paramsarray = Geturlparams (); if (Paramsarray! = null) {for (var i = 0; i < paramsarray.length; i++) {for (Var j in para Msarray[i]) {if (j = = name) {return paramsarray[i][j]; }}}} return null; }
Original address: http://blog.csdn.net/u013176520/article/details/41080307
JS Get URL value