表單的作用:用來收集用戶的相關(guān)信息
表單標(biāo)簽:
<form name="表單的名稱" method="表單提交方式" action="表單提交地址"></form>
method:POST或者GET
notice
: post get 的區(qū)別
get大多時(shí)間是用來獲取api的數(shù)據(jù)
post大多數(shù)用來向服務(wù)器傳遞數(shù)據(jù)
get是把參數(shù)數(shù)據(jù)列隊(duì)加到提交表單的action屬性所指的url中,在url中可以看到
post是通過http post機(jī)制央拖,用戶看不到信息祭阀,當(dāng)然也不是絕對(duì)安全,f11打開瀏覽器調(diào)試窗口可以看到
get傳輸?shù)臄?shù)據(jù)量比較小鲜戒,不能大于2kb专控。
post傳輸?shù)臄?shù)據(jù)量比較大,一般默認(rèn)為不受限制
get安全性比較低遏餐,post安全性比較高
get執(zhí)行效率比post要高
文本框:
<input type = "text" value = "默認(rèn)值">
密碼框:
<input type = "password" >
提交按鈕:
<input type = "submit" value="按鈕內(nèi)容">
重置按鈕:
<input type="reset" value="按鈕內(nèi)容">
單選框/單選按鈕:
<input type="radio" name="rad">
單選按鈕里的name屬性必須寫伦腐,同一組單選按鈕的name屬性的值必須一樣
復(fù)選框:
<input type="checkbox" name="check">
<input type="checkbox" name="check" disabled="disabled">
disabled屬性:disabled為禁用 checked默認(rèn)選中
下拉菜單:
<select name="sel">
<option value="值">菜單內(nèi)容</option>
<option value="值">菜單內(nèi)容</option>
<option value="值">菜單內(nèi)容</option>
</select>
多行文本框:
<textarea name="name" cols="字符寬度" rows="行數(shù)"></textarea>
按鈕:
<input type="botton" value="按鈕內(nèi)容">
//他與submit的區(qū)別在于submit是用來提交數(shù)據(jù)的,而botton只能用來跳轉(zhuǎn)頁面