什么是表單?
在HTML中使用表單和用戶完成交互
name屬性:設(shè)置表單的名稱
action屬性:用來設(shè)置發(fā)送請(qǐng)求的路徑
B/S架構(gòu)中,從瀏覽器B端向服務(wù)器S端發(fā)送數(shù)據(jù),叫做請(qǐng)求,英語單詞:request
B/S架構(gòu)中,從服務(wù)器S端向?yàn)g覽器B端返回?cái)?shù)據(jù),叫做響應(yīng),英語單詞:response
method屬性:用來設(shè)置表單提交數(shù)據(jù)的方式:get、post
get方式:為默認(rèn)提交方式,提交的數(shù)據(jù)會(huì)顯示在地址欄中
post方式:提交的數(shù)據(jù)不會(huì)在地址欄中顯示,相對(duì)安全
\
1. input type類型為text:文本輸入域
<input type=”text” name=”username” />
2.input type類型為password:密碼輸入框
<input type=”password” name=”password” />
input type類型為 radio:單選按鈕
3. <input type=”radio” name=”sex” />
4. input type類型為 checkbox:多選按鈕
<input type=”checkbox” name=”interest” />
5. input type類型為submit:表單提交按鈕
<input type=”submit” name=”注冊(cè)” />
6. input type類型為button:普通按鈕
<input type=”button” name=”提交注冊(cè)” />
7. input type類型為reset:表單重置按鈕
<input type=”reset” name=”重置” />
8. input type類型為file:文件上傳組件
<input type=”file” name=”filename” />
9. input type類型為hidden:隱藏控件
在瀏覽器上看不到,但提交表單的時(shí)候會(huì)提交給服務(wù)器
<input type=”hidden” name=”usercode” />
<select name=”grade” >
<option value=”gz”>高中</option>
<option value=”dz”>大專</option>
</select>
<textarea name=”introduce” cols=”50” rows=”10”></textarea>
<input type=”text” name=”username” value=”zhangsan” readonly />
<input type=”text” name=”user” value=”wangwu” disabled />
<input type=”text” name=”username” size=”10” />
<input type=”text” name=”uname” maxlength=”100” />