日期:2014-05-16  浏览次数:20440 次

用JS获取请求地址中的参数和值
unction GetUrlParameter(paramName) {
            var returnVal = "";
            try {
                var paramUrl = window.location.search;
                //处理长度
                if (paramUrl.length > 0) {
                    paramUrl = paramUrl.substring(1, paramUrl.length);
                    var paramUrlArray = paramUrl.split("&");
                    for (var i = 0; i < paramUrlArray.length; i++) {
                        if (paramUrlArray[i].toLowerCase().indexOf(paramName.toLowerCase()) != -1) {
                            var temp = paramUrlArray[i].split("=");
                            if (temp[0].toLowerCase() == paramName.toLowerCase()) {
                                returnVal = temp[1];
                                break;
                            }
                        }
                    }
                }
            }
            catch (e) { }
            return returnVal;
        }