📌  相关文章
📜  如何在javascript代码示例中获取查询参数

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

代码示例3
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, ' '));
};