a.html
b.html
<html>
<head>
<script>
function setData(){
var ucode=document.forms[0].usercode.value;
var url="b.html?usercode="+ucode;
window.location.href=url;/*把url放到地址栏中*/
}
</script>
</head>
<body>
<form >
<input type="text" value="" name="usercode" />
<input type="button" value="传值" onclick="setData();" />
</form>
</body>
</html>
b.html
<html>
<head>
<script>
function getData(){
var url=window.location.href;//得到地址栏中的url字符串。
var usercode=url.split("=")[1];
alert(usercode);
}
</script>
</head>
<body>
<input type="button" value="得值" onclick="getData();" />
</body>
</html>