function GetQueryString(name) {
var url = document.URL;
var arr = url.split('?');
if (arr.length < 2) {
return '';
}
url = arr[1];
//去掉最后一个#字符
if (url.lastIndexOf('#') == (url.length - 1))
url = url.substring(0, url.length - 1);
var arrQueryStringPair = url.split('&');
if (arrQueryStringPair.length == 0)
return '';
//未采用split方法,因为如果形如backUrl=aHR0cDNweD9zdGF0dXM9Mw==
//的参数采用split方法不能正确获取到等号后面的值
for (var i = 0; i < arrQueryStringPair.length; ++i) {
var startIndex = arrQueryStringPair[i].indexOf('=') + 1;
var sName = arrQueryStringPair[i].substr(0, startIndex - 1);
var result = arrQueryStringPair[i].substr(startIndex, arrQueryStringPair[i].length - startIndex);
if (sName.toLowerCase() == name.toLowerCase()) {
return result;
}
}
return '';
}