form表單簡(jiǎn)單介紹
form元素表示了文檔中一個(gè)區(qū)域脑沿,這個(gè)區(qū)域包含交互控制元件猩谊,用來向web服務(wù)器提交信息
簡(jiǎn)單示例
<!-- 其中用到的屬性
action:表單提交信息到指定的URL處理
name: 設(shè)定當(dāng)前表單標(biāo)識(shí)
method:設(shè)置提交信息的方式本谜,有g(shù)et和post兩種方式
-->
<form action="url" name="form" method="GET" enctype="multipart/form-data">
<input type="text" name="username">
</form>
form表單中常用的標(biāo)簽
首先介紹 input 標(biāo)簽
單行文本域 type屬性 text
<label>用戶名:</label>
<input type="text" name="username" placeholder="請(qǐng)輸入用戶名">
密碼域 type屬性 password
<label for="password">姓名:</label>
<input type="password" id="password" placeholder="請(qǐng)輸入密碼">
單選框 type屬性 radio
<label>性別:</label>
<input type="radio" name="sex" value="男">男
<input type="radio" name="sex" value="女">女
復(fù)選框 type屬性 checkbox
<label>愛好:</label>
<input type="checkbox" name="hobby" value="sing">唱歌
<input type="checkbox" name="hobby" value="dance">跳舞
<input type="checkbox" name="hobby" value="play">玩
按鈕 type屬性 button纹冤,submit, reset
<input type="button" value="普通按鈕">
<input type="submit" value="提交按鈕">
<input type="reset" value="重置按鈕">
隱藏域 屬性
<input type="hidden" name="field_name" value="value">
select標(biāo)簽簡(jiǎn)單示例
<label >MyCar</label>
<select name="car" >
<option value="boyue">博越</option>
<option value="borui">博瑞</option>
<option value="lingke">領(lǐng)克</option>
</select>
多行文本域
<label >留言:</label>
<textarea name="article" id="" cols="30" rows="10">
多行文本
</textarea>
這次只是簡(jiǎn)單記錄清酥,并有介紹各個(gè)標(biāo)簽及其屬性的詳細(xì)特點(diǎn)