html的表單form以及form內(nèi)部標(biāo)簽的使用

字號:


    代碼如下:
    <html>
    <head>
    <title> form表單的使用 </title>
    <!--
    標(biāo)簽名稱:form 表單標(biāo)簽
    屬性:action:提交的去向,目標(biāo)地址的url
    method:設(shè)置提交請求的方式,get和post;默認(rèn)為get
    get和post提交有什么區(qū)別?------------------------
    get傳輸:將內(nèi)容信息放在地址欄傳輸,而且長度限制在1k,而且安全性不好。
    post傳輸:將內(nèi)容房子body信息中傳輸。沒有長度限制。
    子標(biāo)簽:
    input標(biāo)簽:需要提交其中的value,必須有一個(gè)name屬性。
    屬性:type:password 等
    //------------
    通過下面的實(shí)例的演示,發(fā)現(xiàn)在某些情況下可以用form去做鏈接,而且做鏈接的同時(shí)還能提交數(shù)據(jù)到
    這個(gè)目標(biāo)的地址文件上。
    fieldset標(biāo)簽:定義域
    legend標(biāo)簽:定義域的標(biāo)題
    -->
    </head>
    <body>
    <fieldset>
    <legend>form表單標(biāo)簽,子標(biāo)簽實(shí)例:</legend>
    <form action=01列表.html method=get>
    <table border=1px width=800px>
    <tr>
    列表標(biāo)簽:
    <select name=cars>
    <option value=volvo>volvo</option>
    <option value=saab>saab</option>
    <option value=fiat selected=selected>fiat</option>
    <option value=audi>audi</option>
    </select>
    </tr>
    <tr>
    復(fù)選框?qū)嵗?BR>    我喜歡自行車:
    <input type=checkbox name=bike>
    我喜歡汽車:
    <input type=checkbox name=car>
    </tr>
    <tr>
    單選按鈕:
    男性:
    <input type=radio checked=checked name=sex value=male>
    女性:
    <input type=radio name=sex value=female>
    </form>
    <p>當(dāng)用戶點(diǎn)擊一個(gè)單選按鈕時(shí),該按鈕會變?yōu)檫x中狀態(tài),其他所有按鈕會變?yōu)榉沁x中狀態(tài)。</p>
    </tr>
    <tr>
    文本域:
    <textarea rows=10 cols=30>文本域標(biāo)簽的使用</textarea>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
    <tr>
    <td>賬號:</td>
    <td>
    <input name=userid>
    </td>
    </tr>
    <tr>
    <td>密碼:</td>
    <td>
    <input name=pwd>
    </td>
    </tr>
    <tr>
    <td>
    <input type=submit value=確認(rèn)提交/>
    </td>
    <td>
    <input type=reset value=重置/>
    </td>
    </tr>
    </table>
    </form>
    </fieldset>
    </body>
    </html>
    只要是有name和value屬性的標(biāo)簽都可以放在form內(nèi)部,同時(shí)也可以將這些標(biāo)簽的數(shù)據(jù)提交到另一個(gè)url。