我这个cookie 的userName怎么传递到另一个页面并显示?不用jquery
html1
<script type="text/javascript">
function checkForm(){
var userName=document.getElementById("userName");
var userPwd=document.getElementById("userPwd");
if(userName.value==""||userPwd.value=="") {
alert("用户名或密码不能为空");
return false;
}else if(!userName=="admin"&&userPwd=="123456"){
alert("用户名或密码有误");
return false;
}else{
mform.submit();
window.location.href="welcome.html";
}
}
</script>
</head>
<body>
<font size="4" face="微软雅黑" ><center><b>用户登录</b></center></font><br /><br />
<form name="mform" action="" method="post">
<table align="center">
<tr >
<td>用户名:</td><td><input type="text" name="userName" id="userName" placeholder="请输入用户名"/></td>
</tr>
<tr>
<td>密码:</td><td><input type="text" name="userPwd" id="userPwd" placeholder="请输入密码"/></td>
</tr>
<tr>
<td></td><td><input type="button" value="登录" name="btnSubmit" id="brnSubmit" onclick="checkForm()"/>
<input type="button" value="注册" name="btnLogin" align="right"/><font>忘记密码</font></td>
</tr>
</table>
</form>
</body>
html2
<br> var userName=getCookie('userName');<br> document.write("欢迎你:"+userName);</p> <pre><code> </script> </body> </code></pre> <p></html></p>