jsp页面传参

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);

上一篇:关于多个折叠面板点击隐藏互不影响的实现


下一篇:简单随机答案选择器,小抽奖器