常见表单元素☺

(1)单选按钮

1
2
3
4
<input type="text" name="key1" id="">
 <input type="password" name="key1" id="">
 <input type="email" name="key1" id="">
name需要给值 

(2)复选按钮

性别
 <input type="password" name="key1" id="">
  <input type="email" name="key1" id="">
 <!-- 当表单中使用了 radio ,一定要为相同name的radio设置不同的value 让服务端可以辨别 -->  

其中这一点重要,需提交多个选项可以,以数组形式

复制代码
<!-- CheckBox如果没有选中则不会提交,如果选中提交on //选择框 -->
<label for=""><input type="checkbox" name="agree" value="true">同意协议</label>
<br>
<!-- 需要同时提交多个选项,可以再name属性后面跟上[]/ -->
<label for=""><input type="checkbox" name="funs[]" value="foot">篮球</label>
<label for=""><input type="checkbox" name="funs[]" value="bask">组球</label>
<label for=""><input type="checkbox" name="funs[]" value="first">第球</label>
<label for=""><input type="checkbox" name="funs[]" value="e  ">的球</label>

<br>
复制代码

(3)选择框

<!-- 默认提交value的值,没有提交的是文本 选择框-->
<select name="status" id="">
<option >激活</option>
<option value="">为激活</option>
<option value="">袋激活</option>
</select>

 

posted @   酿酿  阅读(38)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
点击右上角即可分享
微信分享提示