//獲取瀏覽器url參數
var methods ={
getQueryString: function (name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
}
};
//調用方法:window.location網址后加上 url?userid=11&name=n1
alert(methods.getQueryString('userid'));
