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 page</title> <script> $(function(){ name = $("#name").text(); age = $("#age").text(); $("#btn").on("click",function(){ jump1(); }); }); function jump1(){ url = "b.html?name="+name+"&age="+age;//Contents are concatenated here window.location.href = url; } </script> </head> <body> <div id="name">tony</div> <div id="age">23</div> <button id="btn">Jump</button> </body> </html> Page b to jump 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>Page 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> The above is the problem of passing parameters in HTML page jump that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! |
<<: Using CSS3 and JavaScript to develop web color picker example code
Here is how to install Tomcat-8.5.39 on centos7.6...
Many times, we expect the query result to be at m...
Today we are going to implement a Thunder Fighter...
Table of contents Preparation Deployment process ...
js interesting countdown case, for your reference...
An n-digit verification code consisting of number...
Table of contents Create a Vite project Creating ...
In Vue, we generally have front-end and back-end ...
Operating system: windowns10_x64 Python version: ...
1. Introduction This article does not have screen...
Table of contents Method 1: Routing meta informat...
Preface This article will explain how Vue compone...
Compared with Windows system, Linux system provid...
Table of contents Overview File Descriptors Synch...
With the rise of mobile terminals such as iPad, p...