<form>表单标签
<form action="action_page.php" method="GET" target="_blank" accept-charset="UTF-8" ectype="application/x-www-form-urlencoded" autocomplete="off" novalidate>
<input type="text/radio/submit" name="">
<br />
<input type="submit" value="提交">
</form>
<input> 元素根据不同的 type 属性,可以变化为多种形态。
<fieldset> 元素组合表单中的相关数据
<legend> 元素为 <fieldset> 元素定义标题。
<select> 元素定义下拉列表<option> 元素定义待选择的选项。
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<textarea> 元素定义多行输入字段(文本域)
<textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
</textarea>
<checkbox>元素定义复选框
<form>
<input type="checkbox" name="vehicle" value="Bike">I have a bike
<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</form>
<button> 元素定义可点击的按钮
<button type="button" οnclick="alert('Hello World!')">Click Me</button>
<input type="number"> 用于应该包含数字值的输入字段。
<form action="/demo/demo_form.asp">
数量(1 到 5 之间):
<input type="number" name="quantity" min="1" max="5">
<input type="submit">
</form>
<input type="date"> 用于应该包含日期的输入字段。
<form>
Enter a date before 1980-01-01:
<input type="date" name="bday" max="1979-12-31"><br>
Enter a date after 2000-01-01:
<input type="date" name="bday" min="2000-01-02"><br>
</form>
<input type="color"> 用于应该包含颜色的输入字段。
<input type="range"> 用于应该包含一定范围内的值的输入字段。
根据浏览器支持,输入字段能够显示为滑块控件。
<input type="month"> 允许用户选择月份和年份
<input type="week"> 允许用户选择周和年。
<input type="time"> 允许用户选择时间(无时区)。
<input type="datetime-local"> 允许用户选择日期和时间(无时区)。
<input type="email"> 用于应该包含电子邮件地址的输入字段。
<input type="search"> 用于搜索字段(搜索字段的表现类似常规文本字段)。
<input type="tel"> 用于应该包含电话号码的输入字段。
<input type="url"> 用于应该包含 URL 地址的输入字段。
<datalist> 元素为 <input> 元素规定预定义选项列表。
<form action="/demo/demo_form.asp">
<input list="browsers" name="browser">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
</datalist>
<input type="submit">
</form>
readonly 属性规定输入字段为只读(不能修改)
disabled 属性规定输入字段是禁用的。
size 属性规定输入字段的尺寸(以字符计)
maxlength 属性规定输入字段允许的最大长度
multiple 属性是布尔属性。如果设置,则规定允许用户在 <input> 元素中输入一个以上的值。multiple 属性适用于以下输入类型:email 和 file。
Select images: <input type="file" name="img" multiple>
placeholder 属性规定用以描述输入字段预期值的提示(样本值或有关格式的简短描述),该提示会在用户输入值之前显示在输入字段中。
<input type="text" name="fname" placeholder="First name">
required 属性是布尔属性。如果设置,则规定在提交表单之前必须填写输入字段。
HTML表单
最新推荐文章于 2024-09-14 15:26:51 发布