radio、checkbox
radioボタン
webサイトでこのようなものを見たことは一度はありませんか?
Colors:RedBlueGreen
これは"radio"ボタンといいます。
ひとつの選択を
させたいときに使うものです。
ちなみに、
"label"タグを・・・
Colors: <label><input type="radio" value="red" name="color">Red</label> <label><input type="radio" value="blue" name="color">Blue</label> <label><input type="radio" value="green" name="color">Green</label>
このように追加すると
Colors:
選択肢の文字に触れただけで
選択にチェックできるようになりました。
checkbox
これは"radio"と同じような使い方で
ソースコードの
type="radio"の部分をtype="checkbox"に変えるだけです。
Colors: <label><input type="checkbox" value="red" name="color">Red</label> <label><input type="checkbox" value="blue" name="color">Blue</label> <label><input type="checkbox" value="green" name="color">Green</label>
Colors:
"label"を使うかはお好みでお選びください。
以上です。