HTMLDOM入力範囲オブジェクト
入力範囲オブジェクト
Input Rangeオブジェクトは、type = "range"のHTML <input>要素を表します。
入力範囲オブジェクトにアクセスする
getElementById()を使用して、type = "range"で<input>要素にアクセスできます。
例
var x = document.getElementById("myRange");
ヒント:フォームの要素コレクションを検索して、<input type = "range">にアクセスすることもできます。
入力範囲オブジェクトを作成する
document.createElement()メソッドを使用して、type = "range"で<input>要素を作成できます。
例
var x = document.createElement("INPUT");
x.setAttribute("type", "range");
入力範囲オブジェクトのプロパティ
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a slider control |
autofocus | Sets or returns whether a slider control should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a slider control |
disabled | Sets or returns whether a slider control is disabled, or not |
form | Returns a reference to the form that contains the slider control |
list | Returns a reference to the datalist that contains the slider control |
max | Sets or returns the value of the max attribute of the slider control |
min | Sets or returns the value of the min attribute of the slider control |
name | Sets or returns the value of the name attribute of a slider control |
step | Sets or returns the value of the step attribute of the slider control |
type | Returns which type of form element the slider control is |
value | Sets or returns the value of the value attribute of a slider control |
入力範囲オブジェクトメソッド
Method | Description |
---|---|
stepDown() | Decrements the value of the slider control by a specified number |
stepUp() | Increments the value of the slider control by a specified number |
標準のプロパティとイベント
Input Rangeオブジェクトは、標準のプロパティとイベントもサポートします。
関連ページ
HTMLチュートリアル:HTMLフォーム
HTMLリファレンス:HTML <input>タグ
HTML参照:HTML <input>タイプ属性