我有一个颜色列表,在我的页面上显示在一个 50 像素的方框中。
我想做的是能够单击任何颜色框,然后它将在下面的 div 中显示单击的颜色。
<div style="background:#000000; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#c9c9c9; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#737373; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#424242; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#184880; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#3485bf; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#9ad8e6; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#006891; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#0f6769; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#009687; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#79c7c2; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#72b88a; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#669100; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#b5cf8c; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#74750e; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#c7c25f; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#faeb69; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#ffffa8; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#ffc824; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#f5652c; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#f0ab5d; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#e36b10; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#bd3a0f; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#996751; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#78502a; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#c2ae97; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#f4f4f4; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#a31d20; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#d4536c; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#e0d1dc; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#513d7a; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#9178ad; width:50px; height:50px; float: left; margin:4px"></div>
<div style="background:#d6cee0; width:50px; height:50px; float: left; margin:4px"></div>
然后当单击其中一种颜色时,它将显示在下面
<div id="result"></div>