2024年05月10日 建站教程
如何利用jQuery语法实现多个页面跨页面参数传递,下面web建站小编给大家简单介绍一下具体实现方法!
<!DOCTYPE html> <html> <head> <title>页面一</title> </head> <body> <script> var urlParam = "parameterValue"; window.location.href = "index2.html?urlParam=" + urlParam; </script> </body> </html>
<!DOCTYPE html> <html> <head> <title>页面二</title> <script src="/staticjs/jquery-3.6.0.min.js"></script> </head> <body> <div id="content"></div> <script> $(document).ready(function(){ var urlParams = new URLSearchParams(window.location.search); var paramValue = urlParams.get("urlParam"); $("#content").text("参数值为:" + paramValue); }); </script> </body> </html>
本文链接:http://so.lmcjl.com/news/4166/