HTML(表单标签)
- <form> 标签
- 用于为用户输入创建 HTML 表单
- 表单能够包含 input 元素,比如:文本字段、复选框、单选框、提交按钮等等
- 表单用于向服务器传输数据
- action 属性:规定当提交表单时向何处发送表单数据
- method 属性:规定用于发送 form-data 的 HTTP 方法
<form> <p>username<input type="text" name="username" id="uid" value="" /></p> <p>password<input type="text" name="password" id="pid" value="" /></p> <input type="button" value="button"> <input type="submit" value="submit" /> <input type="reset" name="" id="" value="reset" /> </form>
- radio 单选
- checked="" 属性:默认选中
- name 属性:设置或返回单选按钮的名称
- type 属性:类型
- value 属性:单选按钮的 value 属性的值
<body> <form> <table border="1" width="200" height="30"> <tr> <td> <input type="radio" checked="" name="sex" id="boy" value="0"> <label for="boy">男</label> <input type="radio" name="sex" id="girl" value="1"> <label for="girl">女</label> <input type="radio" name="sex" id="secret" value="2"> <label for="secret">保密</label> </td> </tr> </table> </form> </body>
- checkbox 复选框
<body> <form> <table border="1" width="300" height="30"> <tr> <td colspan="3" align="center"> <label><input name="subject" id="p" type="checkbox" value="0" />Python </label> <label><input name="subject" id="j" type="checkbox" value="1" />Java </label> <label><input name="subject" id="h" type="checkbox" value="2" />Html </label> <label><input name="subject" id="g" type="checkbox" value="3" />Go </label> </td> </tr> </table> </form> </body>
- select 下拉框
<body> <form> <table border="1" width="100" height="30"> <tr> <td colspan="3"> <select id="school" value="dcs"> <option value="1">多测试深圳校区</option> <option value="2">多测试广州校区</option> <option value="3">多测试上海校区</option> <option value="4">多测试北京校区</option> <option value="5">多测试天津校区</option> </select> </td> </tr> </table> </form> </body>
- file 上传文件
<body> <form> <table border="1" width="100" height="30"> <tr> <td colspan="3"> <input type="file" /> </td> </tr> </table> </form> </body>
作者:Evan0813
微信:ZhengYing8887
出处:https://www.cnblogs.com/ZhengYing0813/
备注:本文版权归作者所有,欢迎转载和添加作者微信探讨技术,但未经作者同意必须在文章页面给出原文链接,否则保留追究法律责任的权利。

浙公网安备 33010602011771号