页面之间相互跳转的参数传递

来源:互联网 发布:div css模板源码 编辑:程序博客网 时间:2024/05/01 22:52

----------原始页面------------

$('#ID').on('click',function () {

        window.open("url?theme="+参数);

 });

 

-----------目标页面JS--------------

function GetRequest() {

            var url = location.search; //获取url中"?"符后的字串

            var theRequest = new Object();

            if (url.indexOf("?") != -1) {

                var str = url.substr(1);

                strs = str.split("&");

                for (var i = 0; i < strs.length; i++) {

                    theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);

                }

            }

            return theRequest;

        }

        var theme_diff=GetRequest();

 

1 0
原创粉丝点击