星期四, 十一月 29, 2007

HTML 預設選取參數(checked/selected)

何時要用 checked, 何時用 selected, 常常都會搞混 .... 整理一下比較實在.

  • checkbox: checked
  • radio: checked
  • select: selected
  • 總之: input 欄位的都是用 checked, select 的用 selected.

Form 的 Input 型態(<input type="型態">)

  • text
  • password
  • file
  • submit
  • image => 這個要另外加上 src="" 的屬性
  • button
  • reset
  • hidden
  • checkbox => 預設勾選 checked
  • radio => 預設選取 checked
  • <input disable> 會把此欄變灰色, 不能 輸入/修改 資料.
  • <input readonly> 此欄的資料就將是唯讀, 沒辦法修改. (感謝 ㄚ凱 提供)

Form 的  Select:(<select><option> ...</option></select>)

  • option => 預設選取 selected

其它參考

相關標籤

this is comment icon readonly 呢? [回覆]

好像沒有列到 readonly ...

disabled 的欄位在送出時候忽略,但是 readonly 的不會...

Comment by ㄚ凱 (11/30/2007 09:53)

this is comment icon 回 ㄚ凱 [回覆]

主要是.... 沒有想到.. Orz....
這篇主要是要記 selected 和 checked 對應哪個 HTML Tag (常搞混)...
不過 還是很感謝提供 readoly 的參數, 已加上... 謝謝~~~ :D

Comment by Tsung (11/30/2007 20:16)
Add this page to del.icio.us Add this page to Yahoo Taiwan's bookmark Add this page to MyShare

發表迴響

標題

內容 (限制 1000 字)

暱稱

電子郵件

個人網頁


 authimage


PS: 若無法留言, 請先確認是否有打開 JavaScript, 造成您的困擾, 實在萬分對不起 Orz...(如果無法留言, 勞煩可以發信給我好嗎? 謝謝.)
PS2: 若您的留言被誤判, 我都會再自行看過, 不需要一直重覆張貼~