input要素において、書き込み不可能とするformの属性は2種類ある
readonlyとdisabledがそれだ。
readonly
w3のサイトにはこう書いてある。
- Read-only elements receive focus but cannot be modified by the user.
- Read-only elements are included in tabbing navigation.
- Read-only elements may be successful.
ユーザーからの書き込みは不可能となるが、タブ移動は可能で、
フォーカスは可能である。
フォームの出力は可能である
例
<input name="b" type="text" value="hoge" readonly="readonly" />
disabled
- Disabled controls do not receive focus.
- Disabled controls are skipped in tabbing navigation.
- Disabled controls cannot be successful.
フォーカスも受け付けない。タブ移動もない。
また、フォームのPOSTも不可能。
<INPUT disabled name="fred" value="stone">
まあ色々使ってみるといいよ。
Forms in HTML documents
Forms in HTML documents
小粋空間: input 要素の disabled 属性と readonly 属性の違い