方法一
1 function fGetQuery(name){2 var sUrl = window.location.search.substr(1);3 var r = sUrl.match(new RegExp("(^|&)" + name + "=([^&]*)(&|$)"));4 return (r == null ? null : unescape(r[2]));5 }
方法二
1 function paramValue (param){ 2 var urlparam = window.location.search; 3 var relparam = param + "="; 4 var isparam = urlparam.indexOf(relparam); 5 if (isparam < 0) return ""; 6 var start = isparam + relparam.length; 7 var ismore = urlparam.indexOf("&", start); 8 var end = ismore < 0 ? urlparam.length : ismore; 9 return urlparam.substring(start, end);10 }
控制好心情,生活才会处处祥和