可能重複:
How can I get a specific parameter from location.search?如何從javascript中的url獲取參數值?
我有類似下面的網址。
http://localhost/xxx.php?tPath=&pid=37
我想要得到的PID = 37,但它的名字,因爲對時間的網址是像上面,然後當刷新頁面,則URL變成像下面這樣。
http://localhost/xxx.php?tPath=&action=xxx&pid=37&value=13&fname=aaaa&fone=4321122
所以我想獲得pid = 37。它可能是一個函數,我將pid作爲參數傳遞給它,並返回它的值。
我該怎麼做?
看到這個答案:http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript/2880929#2880929 – 2012-03-15 11:25:42
這個職位的回答可以幫助你。 http://stackoverflow.com/questions/979975/how-to-get-the-value-from-url-parameter – matheusvmbruno 2012-03-15 11:27:36