本文摘自PHP中文网,作者V,侵删。

效果如下图所示:
a页面

点击跳转按钮后

在b页面可以获取到对应的值。
推荐教程:html教程
代码如下:
a页面:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <!DOCTYPE html>
< html >
< head >
< meta charset = "UTF-8" >
< script src = "js/jquery-3.0.0.min.js" ></ script >
< script src = "js/jquery.params.js" ></ script >
< title >a页面</ title >
< script >
$(function(){
name = $("#name").text();
age = $("#age").text();
$("#btn").on("click",function(){
jump1();
});
});
function jump1(){
url = "b.html?name="+name+"&age="+age;//此处拼接内容
window.location.href = url;
}
</ script >
</ head >
< body >
< div id = "name" >tony</ div >
< div id = "age" >23</ div >
< button id = "btn" >跳转</ button >
</ body >
</ html >
|
将要跳转到的b页面:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <!DOCTYPE html>
<html>
<head>
<meta charset= "UTF-8" >
<script src= "js/jquery-3.0.0.min.js" ></script>
<script src= "js/jquery.params.js" ></script>
<title>b页面</title>
<script>
$( function (){
getData1();
});
function getData1(){
var name = $.query.get( "name" );
var age = $.query.get( "age" );
$( "#name" ).text(name);
$( "#age" ).text(age);
}
</script>
</head>
<body>
<div id= "name" ></div>
<div id= "age" ></div>
</body>
</html>
|
相关视频教程推荐:html视频教程
以上就是详解html中页面跳转传递参数的问题的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
Html5 header标签是什么意思?Html5 header标签的用法详解(附实例)
Html怎么删除表格的第二行
Html5和Html能看出区别吗
Html是什么以及怎么用
Html怎么用link引入css
Html<p>标签是什么元素?关于Html p标签的定义和作用详解
Html中table边框颜色怎么设置
Html中怎么加img路径
支持onload事件的Html标签有哪些
Html网页的列表标签分为哪几种
更多相关阅读请进入《Html》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » 详解html中页面跳转传递参数的问题