On web pages, we often encounter this situation: when we enter information on a certain page, it will jump to another page and pass the information we entered to another page. How do we do it? Let’s take a look at the design ideas first:
The implementation code is: <body> <form action="index.html"> Username: <input type="text" name = 'uname'> <input type="submit" value="Submit"> </form> </body> <body> <div><span style="font-weight:700; color:blue"></span>Welcome to log in! </div> <script> var span = document.querySelector('span'); //Get the span tag var myName = location.search.substr(1); //Get the parameter entered on the previous page var arr = myName.split('='); //Use the = sign to split the key and value span.innerHTML = arr[1] + '' //Pass the data into span </script> </body> The running effect is: This concludes this article on the transmission of JavaScript data on different pages (URL parameter acquisition). For more information on the transmission of JavaScript data on different pages, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: MySQL database transaction example tutorial
>>: About input file control and beautification
What is serdel userdel is a low-level tool for de...
HTML5 adds more semantic tags, such as header, fo...
Why do we need master-slave replication? 1. In a ...
Table of contents 1. Phenomenon 2. Solution 3. Su...
Nginx can generally be used for seven-layer load ...
<br />From the launch of NetEase's new h...
Table of contents 1. Problem description: 2. Trou...
What is a mata tag The <meta> element provi...
Table of contents 1. Get the value of browser coo...
Vue uses Ref to get component instances across le...
What is DOM? With JavaScript, you can reconstruct...
Table of contents 1. Routing and page jump 2. Int...
front end css3,filter can not only achieve the gr...
<br />In the field of network design, resear...
Table of contents Example Method 1: delete Method...