js页面传值的实现
2015-08-05 16:29
573 查看
<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>
相关文章推荐
- js跳转页面实现
- JS绘制生成花瓣效果的方法
- 项目中常用的JS操作技巧
- js格式文件中获取JSP变量的方法
- 使用sina js 根据文件名作股票代码 看股票
- js 利用闭包循环给li绑定参数不同的点击事件
- JS简单实现拖拽可视化构图
- javascript dom与字符串相互转换
- 关于jsp页面中中文乱码问题的解决方法
- JS中函数
- 【JavaScript算法】javascript常用算法
- JSON处理
- js 按键事件
- Jstat使用详解
- xStream完美转换XML、JSON
- ExtJs 请求服务器-自定义默认参数
- JS实现点击上移下移LI行数据的方法
- javascript的一些小知识1
- JSP中文乱码问题终极解决方案
- JS模拟键盘打字效果的方法