form in html

<!-- 表单:用于收集用户的信息  并提交到服务器 -->

<!-- action  提交的地址  method   请求方式   常用的有get和post -->

<form action="1.html" method="get">

用户名: <input type="text" name="usename"><br>
&emsp;码: <input type="password" name="password"><br>

<hr>

<!-- name 属性两个作用  :1提交数据    2.实现分组作用(单选框和多选框)

checked  默认选中

-->

性别: 男<input type="radio" name="nan" checked ><input type="radio" name="nan"><br>

爱好: 抽烟<input type="checkbox" name="fuxuan" checked> 喝酒<input type="checkbox" name="fuxuan" > 烫头<input type="checkbox" name="fuxuan"><br>

<!-- 下拉框 -->

<select name="adress" id="">

<option value="郑州">郑州</option>

<option value="漯河">漯河</option>

<option value="许昌">许昌</option>

<option value="平顶山">平顶山</option>

</select>

<br>

<br>

<!-- 文本域  默认是cols  30列  rows  10行 -->

<textarea name="" id="" cols="30" rows="10"></textarea>

<br>

<!-- 提交按钮 -->

<input type="submit" value="提交" style="width: 200px;">

</form>

<hr>

<form action="1.html" method="get">

  <input type="text" name="usename" placeholder="请输入用户名">

  <!-- 颜色选择 -->

  <input type="color" >

  <!-- 日期 -->

  <input type="date" name="" id="">

  <!-- 选择文件 -->

  <input type="file" name="" id="">

  <!-- 图片 -->

  <input type="image" src="[https://img1.baidu.com/it/u=1511573730,3968996413&fm=253&fmt=auto&app=138&f=JPEG?w=365&h=500](https://img1.baidu.com/it/u=1511573730,3968996413&fm=253&fmt=auto&app=138&f=JPEG?w=365&h=500)" alt="">

  <!-- 数字大小增减 -->

  <input type="number">

  <!-- 重置 -->

  <input type="reset" value="重置">

  <input type="search" name="" id="">

  <!-- 专门的按钮 -->

  <button disabled="disabled">禁用</button>

  <button type="submit">button提交</button>

Summarize

This article mainly summarizes some of our commonly used form attributes and types.

Guess you like

Origin blog.csdn.net/qq_52648305/article/details/124134250