把Javascript对象序列化后作为参数传输
导入js文件:https://files.cnblogs.com/yangyh/json2.js
function Person(name,age,birthday){
this.Name = name;
this.Age = age;
this.Birthday = birthday;
}
var p = new Person("test测123",20,new Date());
var output = JSON.stringify(p);
var url = '('+output+')';
alert(output);
var outP = eval('('+output+')');
e = encodeURIComponent(output)
alert(e);
document.write('Name:'+outP.Name+'<br />')
document.write('Age'+outP.Age+'<br />')
document.write('Birthday'+outP.Birthday)
window.location.href = "t1.html?p="+url;
t1.html:
t=decodeURIComponent(getUrlPara('p'));
alert(eval(t).Name);
躲猫猫社团团长 http://t.sina.com.cn/coolria
浙公网安备 33010602011771号