Input Range max Attribute
Definition and Usage
max
Attribute sets or returns the value of the max attribute of the slider control.
The HTML max attribute specifies the maximum value of the slider control.
Tip:The max attribute is usually used with min attribute Use together to create a valid value range.
Tip:To set or return the value of the min attribute, use min attribute.
See also:
HTML Reference Manual:HTML <input> max 属性
Example
Example 1
Get the maximum allowable value of the slider control:
var x = document.getElementById("myRange").max;
Example 2
Change the maximum value:
document.getElementById("myRange").max = "90";
Syntax
Return max attribute:
rangeObject.max
Set max attribute:
rangeObject.max = number
属性值
值 | 描述 |
---|---|
number | 规定滑块控件允许的最大值。 |
技术细节
返回值: | 字符串值,表示允许的最大值。 |
---|
浏览器支持
表中的数字注明了首个完全支持该属性的浏览器版本。
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 10.0 | 支持 | 支持 | 支持 |