DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> js獲取location.href的參數實例代碼
js獲取location.href的參數實例代碼
編輯:關於JavaScript     

window.location.search.substr(1); //substr(1) 是去掉參數裡最開頭的?號。

復制代碼 代碼如下:
function getQuery(para){
var reg = new RegExp("(^|&)"+para +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null){
return unescape(r[2]);
}
return null;
}

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved