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
Preface In actual development, business requireme...
I recently started learning about database knowle...
Table of contents 1. Using Set()+Array.from() 2. ...
Recently, I need to stress test the server again....
I will not introduce what CUDA is, but will direc...
Table of contents 1 Introduction to nginx 1 What ...
First you need to install Vue-cli: npm install -g...
Friends who are doing development, especially tho...
A long time ago, I summarized a blog post titled ...
Recently, I added a click-to-send email function t...
When vue2 converts timestamps, it generally uses ...
In the process of making web pages, we often use f...
This article example shares the specific code for...
I've been writing a WeChat applet recently an...
Because springboot has a built-in tomcat server, ...