首页 > Web开发 > 详细

js获取地址栏参数

时间:2019-09-20 13:57:07      阅读:78      评论:0      收藏:0      [点我收藏+]
//获取地址栏参数
    getParam:function(name){
        var search = decodeURIComponent(document.location.search);
        var pattern = new RegExp("[?&]" + name + "=([^&]+)", "g");
        var matcher = pattern.exec(search);
        var items = null;
        if (null != matcher) {
            try {
                items = decodeURIComponent(decodeURIComponent(matcher[1]));
            } catch (e) {
                try {
                    items = decodeURIComponent(matcher[1]);
                } catch (e) {
                    items = matcher[1];
                }
            }
        }
        return items;
    },

 

js获取地址栏参数

原文:https://www.cnblogs.com/fqh123/p/11556264.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!