This article mainly introduces the relevant information on the problem of passing parameters in HTML page jumps. Friends who need it can refer to it. I hope it can help everyone.
The effect is as follows:
a page
After clicking the jump button
The corresponding value can be obtained on page b.
The code is as follows:
a page:
<!DOCTYPE html> <html> <head lang="en"> <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> <p id="name">tony</p> <p id="age">23</p> <button id="btn">跳转</button> </body> </html>
B page to be jumped to:
<!DOCTYPE html> <html> <head lang="en"> <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> <p id="name"></p> <p id="age"></p> </body> </html>
Have you learned it? Hurry up and try it yourself.
Related recommendations:
Comparison and summary of the differences between mui page jump methods
php does not use js to implement the page How to implement jump
7 recommended articles about html page jump
The above is the detailed content of Answers to questions about passing parameters in HTML page jumps. For more information, please follow other related articles on the PHP Chinese website!