JS獲取URL中的參數(shù)數(shù)據(jù)
更新時間:2013年12月05日 14:54:45 作者:
這篇文章主要介紹了JS獲取URL中的參數(shù)數(shù)據(jù),有需要的朋友可以參考一下
復(fù)制代碼 代碼如下:
function getParam(paramName) {
paramValue = "";
isFound = false;
if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&");
i = 0;
while (i < arrSource.length && !isFound) {
if (arrSource[i].indexOf("=") > 0) {
if (arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase()) {
paramValue = arrSource[i].split("=")[1];
isFound = true;
}
}
i++;
}
}
return paramValue;
}
如:http://m.fzitv.net/UserQuery.aspx?id=202
getParam("id")為202
相關(guān)文章
了解在JavaScript中將值轉(zhuǎn)換為字符串的5種方法
這篇文章主要介紹了在JavaScript中將值轉(zhuǎn)換為字符串的5種方法,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,下面小編就和大家一起來學(xué)習(xí)下吧2019-06-06
JS highcharts實現(xiàn)動態(tài)曲線代碼示例
這篇文章主要介紹了JS highcharts實現(xiàn)動態(tài)曲線代碼示例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-10-10
bootstrap與pagehelper實現(xiàn)分頁效果
這篇文章主要為大家詳細介紹了bootstrap與pagehelper實現(xiàn)分頁效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-12-12
學(xué)習(xí)使用bootstrap3柵格系統(tǒng)
這篇文章主要教會大家學(xué)習(xí)使用bootstrap3柵格系統(tǒng),bootstrap開發(fā)環(huán)境搭建,還介紹了柵格系統(tǒng)的類型,感興趣的小伙伴們可以參考一下2016-04-04

