【发布时间】:2019-08-08 10:48:03
【问题描述】:
我希望将对象的背景颜色更改为input type color(颜色选择器)中的值。当您单击该对象时。到目前为止,这就是我想出来的。
GetColor(id)
{
document.getElementById(id).style.backgroundColor = document.getElementById("Color Picker").value;
}
<div style="background-color:black; outline-color:black; outline-width:2px; width:500px; height:500px;" id="ExtentionBody" onclick="GetColor('ExtentionBody')"></div>
<div><input name="Color Picker" type="color" id="Color Picker"/></div>
【问题讨论】:
标签: javascript html css colors color-picker