一、
form表單標(biāo)簽語(yǔ)法
<form action="表單提交地址" method="提交方法">
...文本框、按鈕等表單元素
</form>
看下生活案例用圖:

表單圖1

表單圖2
生活當(dāng)中表單使用案例
form表單屬性說(shuō)明
見下面鏈接:
http://www.runoob.com/tags/tag-form.html
其中重要的屬性是 action 和 method 和 enctype
| 參數(shù) | 值 | 說(shuō)明 |
|---|---|---|
| action | 表單的提交地址 | |
| method | get,post,delete,update | 向服務(wù)器的提交方式,get都是明文,post 一般參數(shù)會(huì)隱藏 |
| enctype | 1.application/x-www-form-ur|encoded:默認(rèn)的編碼方式,將空件中的值 處理成URL編碼方式。2、mutipart/form-data:以二進(jìn)制流的方式來(lái)處理表單數(shù)據(jù)。3、text/plain:當(dāng)表單的action屬性值為mailto:URL的形式時(shí)使用 | 提交表單的編碼方式 |
<form> 元素包含一個(gè)或多個(gè)如下的表單元素:
<input> 輸入 按鈕 文件上傳 單選 多選 等等
<textarea> 輸入框域 可以輸入很多的文字
<button> 按鈕
<select> 下拉選擇
<option> 下拉選擇選項(xiàng)
<optgroup> 分組
<fieldset> 屬性值
<label> 文本
input標(biāo)簽常用type重點(diǎn)說(shuō)明
單行文本:指定<input .../> type屬性為 text 即可
密碼輸入框:指定<input .../> type屬性為 password 即可
隱藏域:指定<input .../> type屬性為 hidden 即可
單選框:指定<input .../> type屬性為 radio 即可
復(fù)選框:指定<input .../> type屬性為 checkbox 即可
上傳文件:指定<input .../> type屬性為 file 即可
提交、重置:指定<input .../> type屬性為 submit、reset 或者普通按鈕button即可
input標(biāo)簽中常用的屬性
| 屬性名 | 描述 |
|---|---|
| checked | 設(shè)置單選框初始狀態(tài)是束處于選中狀態(tài),只有當(dāng)type屬性為checkbox或radio時(shí)才可指定 |
| disabled | 設(shè)置首次加載時(shí)禁用此元素 type ="hidden" 時(shí)不能一該屬性 |
| maxlength | 該屬性是一個(gè)數(shù)字,指定文框中所充許輸入的最大字符數(shù) |
| readonly | 指定該文 本框內(nèi)的值 不允許修改(可以使用javascript腳本修改) |
| size | 該屬性是一個(gè)數(shù)字,指定該元素的長(zhǎng)度。當(dāng)type="hidden"時(shí)不有指定該屬性 |
| src | 指定圖像域所顯示的圖像URL,只有當(dāng)type="image"時(shí)才可以指定該屬性 |
HTTP請(qǐng)求詳解:
http://www.cnblogs.com/li0803/archive/2008/11/03/1324746.html
input案例
<!DOCTYPE html>
<html>
<head>
<title>表單案例</title>
</head>
<body>
<h3>交友網(wǎng)站注冊(cè)</h3>
email:<input type="text" name="email" >
<form action="success.html" method="post">
用戶名:<input type="text" name="username"><br>
密碼:<input type="password" name="password"><br>
確認(rèn)密碼:<input type="password" name="repassword"><br>
驗(yàn)證碼:<input type="text" maxlength="6" name="verifycode"><br>
姓別:<input type="radio" name="sex" value="1"> 男
<input type="radio" name="sex" value="0"> 女
<input type="radio" name="sex" value="2"> 人妖
<input type="radio" name="sex" value="3"> 雙性
<input type="radio" name="sex" value="4"> 保密<br>
愛好:<input type="checkbox" name="hobby" value="1"> 學(xué)習(xí)
<input type="checkbox" name="hobby" value="2"> 打王者
<input type="checkbox" name="hobby" value="3"> 睡覺(jué)
<input type="checkbox" name="hobby" value="4"> 吃飯
<input type="checkbox" name="hobby" value="5"> 做飯 <br>
個(gè)性簽名:<input type="text" maxlength="30" name="signature"><br>
個(gè)人簡(jiǎn)介:<textarea rows="7" cols="60" name="resume">aabbccdd</textarea><br>
<input type="submit" name="submit" value=" 注冊(cè) "> <input type="reset" name="reset">
</form>
</body>
</html>
效果

09B2AB96-3B7C-437E-9660-6C32E61297A0.png