sessionStorage

时间:2021-02-07 14:49:06
for(i=0;i<tkt.length;i++){
if(tkt[i].redEnvelopeType==1){
full1+="<div class='pic_01' id='fa'>"
full1+="<div class='content'><span class='cash01'><b id='cash'>"+tkt[i].redContent +"</b></span>"
full1+="<span class='endline'>有效期至"+tkt[i].expireTime+"</span></div><div class='btn' redEnvelopeActivityId='"+tkt[i].redEnvelopeActivityId+"' >"
full1+="<input type='button' class='give' value='发红包'><input type='button' class='use' value='使用'></div></div>" sessionStorage.setItem("carD"+i,tkt[i].redContent);
var z=sessionStorage.getItem("carD"+i);
console.log(z);
}; 在另一个页面调的时候
var rdpcode=sessionStorage.getItem("redcode");

一定要给[key]加引号,不然它会报key is not defined