4 HTML5中form表單的新增屬性
在創(chuàng)建Web應(yīng)用時(shí),會(huì)用到大量的表單元素苔严,HTML5中為表單增加了很多誘人的屬性,強(qiáng)化了表單元素的功能喳张,使得關(guān)于表單的編寫更快、更方便昼捍。
<meta charset="utf-8">
<form id="login" action="login.php" method="get">
</form>
<input form="login" list="listtest" autofocus autocomplete="off" type="text" name="username"> <br>
<input form="login" placeholder="please input value!" type="text" name="username"> <br>
<input form="login" formaction="one.php" formmethod="get" type="submit" name="dosubmit" value="刪除"><br>
<input form="login" formaction="two.php" formmethod="post" type="submit" name="dosubmit" value="通過(guò)"><br>
<input form="login" formaction="three.php" formmethod="get" type="submit" name="dosubmit" value="不通過(guò)"><br>
<datalist id="listtest">
<option>this is one</option>
<option>this is two</option>
<option>this is three</option>
<option>this is four</option>
</datalist>
from.html
<meta charset="utf-8">
<form id="login" action="login.php" method="get">
</form>
<input form="login" type="text" name="username" value="admin"> <br>
<input form="login" type="submit" name="dosubmit" value="登錄">
<form id="login1" action="login1.php" method="get">
</form>
<input form="login1" type="text" name="username" value="admin"> <br>
<input form="login1" type="submit" name="dosubmit" value="登錄">
from1.html
<meta charset="utf-8">
<form id="login" action="login.php" method="get">
</form>
<input form="login" type="text" name="username" value="admin"> <br>
<input form="login" formaction="one.php" formmethod="get" type="submit" name="dosubmit" value="刪除"><br>
<input form="login" formaction="two.php" formmethod="post" type="submit" name="dosubmit" value="通過(guò)"><br>
<input form="login" formaction="three.php" formmethod="get" type="submit" name="dosubmit" value="不通過(guò)"><br>
from2.html
<meta charset="utf-8">
<form id="login" action="login.php" method="get">
</form>
<input form="login" placeholder="please input value!" type="text" name="username"> <br>
<input form="login" formaction="one.php" formmethod="get" type="submit" name="dosubmit" value="刪除"><br>
<input form="login" formaction="two.php" formmethod="post" type="submit" name="dosubmit" value="通過(guò)"><br>
<input form="login" formaction="three.php" formmethod="get" type="submit" name="dosubmit" value="不通過(guò)"><br>