html局部页面刷新和跳转传参
2017-03-18 14:31
302 查看
index.html为父页面,A.html和B.html为局部刷新的子页面。
页面跳转:
如index.html所示,用<iframe>标签实现页面的嵌套。参数传递:
当需要传递参数时,可使用js实现为跳转页面的同时传参,获取的参数需要解码。1.index.html
<!DOCTYPE html> <html style="height: 100%;overflow: hidden;"> <head> <title>页面跳转</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body style="height: 100%;overflow: hidden;"> <li><a href="A.html" target="con">跳转A</a></li> <br/> <li><a href="B.html" target="con">跳转B</a></li> <br/> <iframe name="con" src="A.html"></iframe> </body> </html>
2.A.html
<!DOCTYPE html> <html style="height: 100%;overflow: hidden;"> <head> <title>A页面</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body style="height: 100%;overflow: hidden;"> <h4>A页面</h4> <button id="bt" onclick="jump()">传参</button> <script type="text/javascript"> function jump(){ var name="跳转成功"; location.href="B.html?name="+name; } </script> </body> </html>
3.B.html
<!DOCTYPE html> <html style="height: 100%;overflow: hidden;"> <head> <title>B页面</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body style="height: 100%;overflow: hidden;"> <h4>B页面</h4> <button id="bt" onclick="show()">获取参数</button> <script type="text/javascript"> var str=this.location.search; var val1=str.split("name="); var val2=val1[1]; //url解码 val2=decodeURI(val2); function show(){ alert(val2); } </script> </body> </html>
相关文章推荐
- JSP定时任务 定时跳转后台,局部刷新页面
- html基础 meta标记 每隔五秒网页刷新一次 打开网页10秒钟后跳转指定页面
- html 页面几秒刷新 & 跳转
- HTML页面刷新、跳转
- HTML页面局部刷新
- HTML meta refresh 刷新与跳转(重定向)页面
- jquery使用iframe实现HTML页面局部刷新代码
- pjax实现页面局部刷新跳转
- html(对php也有效)页面自动刷新和跳转(简单版本)
- HTML 重定向 ----定时跳转刷新页面
- HTML meta refresh 刷新与跳转(重定向)页面
- html meta标签 refresh 实现HTML自动刷新页面和跳转(重定向)
- HTML页面头部标记知识(可以设置自动刷新和自动跳转等功能)
- HTML点击按钮或链接不跳转只刷新页面的方法
- HTML教程,XHTML教程-- meta 标签--meta refresh 刷新与跳转页面
- html刷新和定时跳转页面
- HTML meta refresh 刷新与跳转(重定向)页面
- HTML meta refresh 刷新与跳转(重定向)页面
- HTML meta refresh 刷新与跳转(重定向)页面
- HTML meta refresh 刷新与跳转(重定向)页面