HTML DOM Input Color value property
Examples
Color Picker to modify the default color:
document.getElementById("myColor").value = #FF8040;
try it"
Definition and Usage
value property sets or returns the color picker value property values.
value attribute describes the default color picker color.
Note: The default color is # 000000 (black).
Browser Support
All major browsers support attribute value.
Note: Internet Explorer and Safari browsers do not support the <input type = "color"> element.
grammar
Returns the value property:
colorObject .value
Set the value property:
colorObject .value= #hexvalue
Property Value
值 | 描述 |
---|---|
#hexvalue |
指定拾色器的颜色。 value 必须是一个十六进制值 (hex) :3双位数字, 开始标记为 # (如: #FF8040)。 注意: 颜色单词 (如: 不允许使用 "red" 或 "blue") 。 注意: 默认值为: #000000 (黑色)。 |
technical details
return value: | String that represents a color value |
---|
More examples
Examples
Get Color Picker color:
var x = document.getElementById("myColor").value;
x The output is: #ff0080
try it"
related articles
HTML Tutorial: HTML Color
HTML Tutorial: HTML color value (HEX)
HTML Reference Manual: HTML <the INPUT> value The property
Input Color Object