HTMLDOM入力ラジオオブジェクト
入力無線オブジェクト
Input Radioオブジェクトは、type = "radio"のHTML <input>要素を表します。
入力無線オブジェクトにアクセスする
getElementById()を使用して、type = "radio"で<input>要素にアクセスできます。
例
var x = document.getElementById("myRadio");
ヒント:フォームの要素コレクションを検索して、<input type = "radio">にアクセスすることもできます。
入力無線オブジェクトを作成する
document.createElement()メソッドを使用して、type = "radio"で<input>要素を作成できます。
例
var x = document.createElement("INPUT");
x.setAttribute("type", "radio");
入力無線オブジェクトのプロパティ
Property | Description |
---|---|
autofocus | Sets or returns whether a radio button should automatically get focus when the page loads |
checked | Sets or returns the checked state of a radio button |
defaultChecked | Returns the default value of the checked attribute |
defaultValue | Sets or returns the default value of a radio button |
disabled | Sets or returns whether the radio button is disabled, or not |
form | Returns a reference to the form that contains the radio button |
name | Sets or returns the value of the name attribute of a radio button |
required | Sets or returns whether the radio button must be checked before submitting a form |
type | Returns which type of form element the radio button is |
value | Sets or returns the value of the value attribute of the radio button |
標準のプロパティとイベント
Input Radioオブジェクトは、標準のプロパティとイベントもサポートします。
関連ページ
HTMLチュートリアル:HTMLフォーム
HTMLリファレンス:HTML <input>タグ
HTML参照:HTML <input>タイプ属性