HTML页面间传值

页面一:

 window.location="./showUserMsg.html?IDno="+IDno+"&&thedate="+thedate;

页面二:

    var IDno = getParams("IDno");
    console.log(IDno);
    var thedate = getParams("thedate");    
//获取传过来的值方法封装
    function getParams(key) {
        var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return unescape(r[2]);
        }
        return null;
    };

猜你喜欢

转载自www.cnblogs.com/luzhanshi/p/11803026.html