<pre name="code" class="html"><html>
<head>
<title页面之间传值</title>
<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="js/jquery.params.js" type="text/javascript"></script>
<script type="text/javascript">
function winlocation () {
//1.var arr="wawaw";
//1.var url="chuanzhi2.jsp?value="+arr+"&val=haha"
//1.window.location.href=url;
//2.window.open("chuanzhi2.jsp");
//3.document.cookie="value=wawa"
//3.window.location.href="chuanzhi2.jsp"
/*
1.拼凑url,跳转到url,在跳转页面中$.query.get("value");需要导入jquery.params.js
2.传递控件的值:在跳转页面中$("#text").val(window.opener.document.getElementById("旧页面控件id").value);
3.cookie:旧页面设置cookie值,新页面获取document,cookie.xxxxx(传多个key/value还需改进
*/
}
</script>
</head>
<body>
<button onclick="winlocation()">location</button>
<input type="text" id="textt"></input>
<br>
<br>
</body>
</html>
<html>
<head>
<title页面之间传值</title>
<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="js/jquery.params.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
//1.var value=$.query.get("value");
//1.$("#text").val(value);
//2.$("#text").val(window.opener.document.getElementById("textt").value);
//3.$("#text").val(document.cookie.split("=")[1]);
});
</script>
</head>
<body>
<input type="text" id="text"></input>
<br>
<br>
</body>
</html>