js页面传值的实现

<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>




                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值