单个url参数的获取方式

function getUrlParam(k) {

var regExp = new RegExp('([?]|&)' + k + '=([^&]*)(&|$)');

var result = window.location.href.match(regExp);

if (result) {

return decodeURIComponent(result[2]);

} else {

return null;

}

}
posted @ 2018-06-15 15:41  躁动的倾听者  阅读(89)  评论(0编辑  收藏  举报