頁面一:
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; };