JavaScript:獲取網址URL查詢參數
/* 獲取URL查詢參數 */ function getSearch(param){ var search=location.search.substr(1); var locate=search.search(param); var paramString=''; if(locate!==-1){ var searchRest=search.substr(locate); var len=searchRest.length; var and=searchRest.search('&'); if(and==-1){paramString=searchRest.substr(param,len);} else{paramString=searchRest.substr(param,and);} var paramArray=paramString.split('='); return paramArray[1]; }else{ return false; } };