页面跳页面的参数获取
第一个页面跳转传参
window.location.href='aa.html?id='+id
第二个页面获取参数id
split()把字符串变成数组
window.location.href.split('=')[1]
a标签传汉字
window.location.href='aa.html?id='+encodeURI(id)
接收汉字
var content=decodeURI(location.href.split('=')[1])
-
第一个页面(a.html):
-
var obj = a.value; //传给弹出页面参数
-
var url = 'jxb.html?obj='+obj;
-
url = encodeURI(url);
-
window.open(url, "", "width=600,height=400");
-
第二个页面(b.html):
-
var url = decodeURI(window.location.href);
-
var argsIndex = url .split("?obj=");
-
var arg = argsIndex[1];