标签:code component cname function name element 获取 传参 price
a页面传参
$(window).attr("location","jsp/"+data+".jsp?cname="+cname+"&textarea="+textarea+"&cphone="+cphone);
b页面接参
var data =(function GetRequest() {
debugger;
var theRequest = new Object();
var url = location.search; //获取url中"?"符后的字串
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;
})();
document.getElementById("cname").innerHTML=data.cname;
document.getElementById("textarea").innerHTML=data.textarea;
document.getElementById("cphone").innerHTML=data.cphone;
document.getElementById("price").innerHTML=data.price;
console.log(data);
标签:code component cname function name element 获取 传参 price
原文地址:https://www.cnblogs.com/xiaozhuing/p/12158717.html