Form submission code 1. Source code analysis <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <form action="/form.html" method="GET"> <!-- action: the address to which the form is submitted--> <!-- method: method for submitting insurance policy --> <div class="name"> <label for="name">Username</label> <input type="text" name="name" id="name" placeholder="Please enter your user name"> <!-- placeholder is a transparent prompt text --> </div> <div class="password"> <label for="password">Password</label> <input type="password" name="password" id="password" placeholder="Please enter your password"> </div> <div class="sex"> <label for="sex">Gender</label> <input type="radio" name="sex" value="male">Male<input type="radio" name="sex" value="female">Female</div> <div class="city"> <label for="city">Favorite city</label> <select name="city" id="city"> <option value="beijing">Beijing</option> <option value="shanghai">Shanghai</option> <option value="chongqing" selected >Chongqing</option> <!-- selected indicates the option that is selected and displayed on the page --> </select> </div> <div class="hobby"> <label for="hobby">Hobbies</label> <input type="checkbox" name="hobby" value="read">Reading<input type="checkbox" name="hobby" value="flower">Flower arranging<input type="checkbox" name="hobby" value="sing">Singing<!-- All option names must be the same--> </div> <div class="area"> <textarea id="area" name="area" cols="30" rows="10"></textarea> </div> <button>button</button> <!-- You can submit the form --> <input type="submit" value="submit"> <!-- You can submit the form --> <input type="button" value="button"> <!-- Cannot submit form--> <input type="reset" value="reset"> <!-- Reset the content already entered in the form --> </form> </body> </html> 2. Terminal operation Open the terminal gitbash and switch to the folder where html is located Use the command line http-server to open the static server, and two IP addresses will appear after opening it. 127.xxx is the local access address, 125.xxx is the LAN access address (the premise here is that nodejs has been installed and the http-server server has been installed with npm) Open the html file with your browser. Replace the local file address with http://127.0.0.1:8080. Click on Check-network-header to see the information submitted by the form 3. Differences between get and post methods
4. Notes All input tags must be added with a name attribute, otherwise the data cannot be received correctly. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Summarize the common properties of BigIn functions in JavaScript
>>: Detailed explanation on how to install MySQL database on Alibaba Cloud Server
How can I hide the scrollbars while still being a...
Enable WSL Make sure the system is Windows 10 200...
Preface NAT forwarding: Simply put, NAT is the us...
1. Before configuring the IP address, first use i...
Table of contents 1. Easy to read code 1. Unified...
Let me share with you a creative opening realized...
I think everyone often worries about finding pict...
The error is as follows: Uncaught TypeError: Cann...
JPQL stands for Java Persistence Query Language. ...
This article example shares the specific code of ...
Table of contents 1. React.FC<> 2. class xx...
Table of contents 1. Decoupled assignment of arra...
Baidu Cloud Disk: Link: https://pan.baidu.com/s/1...
query_cache_limit query_cache_limit specifies the...
Copy code The code is as follows: <style type=...