1
function queryURLParameter(url) {
var obj = {};
var reg = /([^?=&]+)=([^?=&]+)/g;
url.replace(reg, function () {
obj[arguments[1]] = arguments[2];
});
return obj;
}
var url = window.location.href;
var num = queryURLParameter(url)["num"];
2原型修改
String.prototype.queryURLParameter =function queryURLParameter() {
var reg =/([^?&=]+)=([^?&=]+)/g,obj = {};
this.replace(reg,function () {
obj[arguments[1]] =arguments[2];
});
return obj;
};
网友评论