表單的用法以及相關(guān)元素

元素<form>
相關(guān)屬性包括

  • <form action="action_page.php">
    action 屬性是要傳遞到的服務器地址,不填寫默認傳遞當前頁面
  • <form method="GET">
    method屬性是規(guī)定傳遞數(shù)據(jù)的方式,有post與get兩種
    簡單來說,get用于提交簡單內(nèi)容,大小受限,且安全性不好。
    post無大小限制,安全性好,適用于較大數(shù)據(jù)文件的提交。
其他屬性

元素<input>

  • <input type="text"> 文本屬性
  • <input type="password">密碼屬性
  • <input type="submit" value="submit"> 提交屬性
  • <input type="radio"> 單選屬性
  • <input type="checkbox"> 定義復選框。
  • <input type="button> 定義按鈕
  • <input type="date"> 定義用于應該包含日期的輸入字段(data、week、month、time、datetime、local-datetime;
  • <input type="number">用于應該包含數(shù)字值的輸入字段。


    QQ截圖20160820210751.png

    元素select 下拉列表
    <select name="cars">
    <option value="volvo">V'olvo</option>
    <option value="fiat" selected>Fiat</option>
    </select>
    通過添加selected屬相,選擇預選項

元素<textarea>文本域
<textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
</textarea>

元素<button>
<button type="button" onclick="alert('Hello World!')">Click Me!</button>

文本域

元素<fieldset><legend>
<fieldset>
<legend>Personal information:</legend>

QQ截圖20160820140755.png
輸入限制

更多資料

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容