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
This article shares the specific code of JavaScri...
Before introducing the GROUP BY and HAVING clause...
Preface To put it simply, tcpdump is a packet ana...
A jQuery plugin every day - to make search histor...
Due to encoding reasons, garbled characters will ...
The javascript function for converting <table&g...
Today I will introduce to you a difference betwee...
I like to pay attention to some news on weekdays a...
This is a very important topic, not only for Linu...
The solution to the problem that the PHP7.3 versi...
This article shares the specific code of uni-app ...
This article refers to the work of 51CTO blog aut...
Table of contents Preface advantage: shortcoming:...
Here is a common one-click performance test scrip...
Achieve resultsImplementation Code html <input...