8-03 4,926 views
<form action="1.php" method="post">
邮箱: <input type="email"><br/>
网址: <input type="url"><br/>
数值: <input type="number" min="1" max="10" step="2"><br/>
range区间: <input type="range" name="range" min="1" max="11" step="2"><br/>
日期: <input type="date" name="date"><br/>
月month: <input type="month" name="month"><br/>
星期week: <input type="week" name="week"><br/>
时间time: <input type="time" name="time"><br/>
日期时间datetime-local: <input type="datetime-local" name="datetime_local"><br/>
搜索search: <input type="search" name="search"><br/>
电话tel: <input type="search" name="search"><br/>
正则表达式验证表单(输入0或者1):<input type="text" name="title" pattern="[1|0]" title="请输入1 或0"><br />
表单内容不能为空:<input type="text" name="title" required title="表单内容不能为空"><br />
文本框提示信息:<input type="text" name="title" placeholder="我是提示信息!"><br />
颜色color: <input type="color" name="color"><br/>
默认获得焦点:<input type="name" autofocus="on"><br/>
<input type="submit">
</form><br />
定义选项列表,用于输入自动匹配
<form action="1.php" method="post" autocompelete="on">
<input type="text" name="city" list="citylist">
<datalist id="citylist" >
<option value="北京">北京</option>
<option value="南京">南京</option>
<option value="广东">广东</option>
</datalist><br />
<input type="submit" value=""/>
</form><br />
formaction:重写表单的action属性:
<form id="form" action="1.php" method="post" autocompelete="on">
点击跳转a.php<input type="submit" formaction="a.php" formmethod="get"/>
点击跳转b.php<input type="submit" formaction="b.php" formtarget="_blank"/>
</form> <br />
设置multiple属性后可以选择多文件:
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file[]" multiple="multiple"><br />
<input type="submit"/>
</form>