起始標籤 | 結束標籤 |
---|---|
需要 | 需要 |
<form> 有幾個屬性
屬性 | 值 | Deprecated or Obsolete |
---|---|---|
action | 網址 | |
method | get post | |
enctype | ||
accept-charset | 字元編碼 | |
accept | HTML 4 Obsolete | |
name | ||
target | _self _blank _parent _top |
<form> 的 action 屬性可以指定應用程式的網址,若有設定傳送按鈕,便可將資料傳送到相關伺服器進行計算。
例如以下為單選的表單
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | < html > < head > < title >網頁標題</ title > </ head > < body > < form action = "伺服器網址" method = "post" > < fieldset > < legend >標題</ legend > < label >< input type = "radio" name = "1" />選項一</ label >< br / > < label >< input type = "radio" name = "1" />選項二</ label >< br / > < label >< input type = "radio" name = "1" />選項三</ label >< br / > < label >< input type = "radio" name = "1" />選項四</ label >< br / > < label >< input type = "radio" name = "1" />選項五</ label >< br / > < br / > < button type = "reset" >重設</ button > < button type = "submit" >送出</ button > </ fieldset > </ form > </ body > </ html > <!-- 《程式語言教學誌》的範例程式 檔名:formexample12.html 功能:示範 HTML 4.01 標記語言的使用 作者:張凱慶 時間:西元 2011 年 5 月 --> |
利用瀏覽器 (broswer) 開啟,結果如下

單選就是只能選其中一個選項

以下為多選的表單
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | < html > < head > < title >網頁標題</ title > </ head > < body > < form action = "伺服器網址" method = "post" > < fieldset > < legend >標題</ legend > < label >< input type = "checkbox" name = "1" />選項一</ label >< br / > < label >< input type = "checkbox" name = "1" />選項二</ label >< br / > < label >< input type = "checkbox" name = "1" />選項三</ label >< br / > < label >< input type = "checkbox" name = "1" />選項四</ label >< br / > < label >< input type = "checkbox" name = "1" />選項五</ label >< br / > < br / > < button type = "reset" >重設</ button > < button type = "submit" >送出</ button > </ fieldset > </ form > </ body > </ html > <!-- 《程式語言教學誌》的範例程式 檔名:formexample12.html 功能:示範 HTML 4.01 標記語言的使用 作者:張凱慶 時間:西元 2011 年 5 月 --> |
如下

多選就是可以選取超過一個以上的選項

中英文術語對照 | |
---|---|
區塊元素 | block element |
瀏覽器 | broswer |
您可以繼續參考
相關目錄
HTML 4.01 快速導覽 - 目錄
HTML, CSS 教材
首頁
參考資料
沒有留言:
張貼留言