html使用a标签从一个页面带数据跳转到另一个页面

2022-06-25 13:26:41

实现从一个页面带着某个数据传输到下一个页面,下一页面根据此数据进行一些处理。
从a.html跳转到b.html

a.html跳转代码

<ahref='b.html?daka_id="+pbId+"'target='main'>跳转</a>

b.html取出a.html传来的数据(js代码)

var daka_id;//a.html传来的数据$(function(){var a=GetRequest();
    daka_id= a['daka_id'];//取a.html传来的所有参数functionGetRequest(){var url= location.search;//获取url中"?"符后的字串var theRequest=newObject();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;}});
  • 作者:面冷心慈的木易
  • 原文链接:https://blog.csdn.net/MuYIShan1/article/details/105414077
    更新时间:2022-06-25 13:26:41