get方式提交的标题栏:http://localhost:8080/?action=&username=&password=&boy=on&from=中国&desc=默认值
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form action="http://localhost:8080" method="get"> <input type="hidden" name = "action"> <h1 align="center">用户注册</h1> <table align="center"> <tr> <td>用户名:</td> <td><input type="text" name = "username"></td> </tr> <tr> <td>密码: </td> <td><input type="password" name = "password"></td> </tr> <tr> <td>性别:</td> <td> <input type="radio" checked = "checked" name = "boy">男 <input type="radio" name="girl">女 </td> </tr> <tr> <td>兴趣爱好:</td> <td><input type="checkbox" name="java">Java <input type="checkbox" name="javasript">JavaScript <input type="checkbox" name = "c++">C++ </td> </tr> <tr> <td>国籍:</td> <td> <select name = "from"> <option>---默认选择值---</option> <option selected ="selected">中国</option> <option>美国</option> <option>澳大利亚</option> </select> </td> </tr> <tr> <td>自我评价:</td> <td><textarea rows="10" cols="20" name = "desc">默认值</textarea></td> </tr> <tr> <td><button type="reset">重置</button></td> <td align="center"><button type="submit" >提交</button></td> </tr> </table> </form> </body> </html>
效果预览:
关于提交后的地址栏:
表单中的input标签必须写好name,否则不会显示
select标签每个option都需要name
原文:https://www.cnblogs.com/zhangpeishi/p/14437757.html