什么是表單?
在HTML中使用表單和用戶完成交互
name屬性:設置表單的名稱
action屬性:用來設置發送請求的路徑
B/S架構中,從瀏覽器B端向服務器S端發送數據,叫做請求,英語單詞:request
B/S架構中,從服務器S端向瀏覽器B端返回數據,叫做響應,英語單詞:response
method屬性:用來設置表單提交數據的方式:get、post
get方式:為默認提交方式,提交的數據會顯示在地址欄中
post方式:提交的數據不會在地址欄中顯示,相對安全
\
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=”注冊” />
6. input type類型為button:普通按鈕
<input type=”button” name=”提交注冊” />
7. input type類型為reset:表單重置按鈕
<input type=”reset” name=”重置” />
8. input type類型為file:文件上傳組件
<input type=”file” name=”filename” />
9. input type類型為hidden:隱藏控件
在瀏覽器上看不到,但提交表單的時候會提交給服務器
<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” />