1 ///获取url中指定参数 2 // <param name="paras">参数名称</param> 3 /// 4 function request(paras) { 5 var url = location.href; 6 var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&"); 7 var paraObj = {} 8 for (i = 0; j = paraString[i]; i++) { 9 paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length); 10 } 11 var returnValue = paraObj[paras.toLowerCase()]; 12 if (typeof (returnValue) == "undefined") { 13 return ""; 14 } else { 15 return returnValue; 16 } 17 }
http://blog.csdn.net/aganar/article/details/6202642