用户注册成功后将内容显示在另一页面
尝试用window.open解决不知道问题出现在哪里
求助或者其他解决方法
a.html
b.html
用户注册成功后将内容显示在另一页面
尝试用window.open解决不知道问题出现在哪里
求助或者其他解决方法
a.html
b.html
你可以用sessionStorage传值。只要不跨域这种方法很好用。
a.html
<input type="text" id="user" value="aabb" />
<input type="button" value="打开b.html" onclick="op();" />
<script type="text/javascript">
function op() {
//在打开b页面之前把要传的值放到sessionStorage中
sessionStorage.user = document.getElementById("user").value;
window.open("b.html");
}
</script>
b.html
<div id="1"></div>
<script type="text/javascript">
var str = sessionStorage.user;
document.getElementById("1").innerHTML = str;
</script>
这种方法不限制页面跳转的方式,不论是用window.open()还是location.href,或者表单提交和a标签超链接都可以。