📌  相关文章
📜  js 获取查询参数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:18.490000             🧑  作者: Mango

代码示例5
function getUrlParameter(name) {
    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(location.search);
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};