首页 > Web开发 > 详细

js获取URL参数

时间:2015-11-27 17:17:23      阅读:209      评论:0      收藏:0      [点我收藏+]
       var ID= getParam(‘ID‘);//获取ID


        var getParam = function (name) {
            var search = 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;
        };
    </script>

 

js获取URL参数

原文:http://www.cnblogs.com/mchuang/p/5001034.html

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