I’m creating something similar to the paint box that you get in paint for a website with similar functionality. double click on a specific color and it gives you various shades. the various shades along with the alt tags are displayed in another div with z-index 1./ The way I setout to do this is using a 2 dimensional array to store the color hex and alt values but I’m lost as to how I can populate the button’s background color from the array and whether to use javascript, JQuery, or JSON. Markup follows:
CSS Style
<style type=”text/css”>
#colorShadesContainer{height:518px; width:95px; border:1px solid #D8D8D8;}
#colorShades{margin-left:2px; margin-top:2px; height:512px; width:89px; position:relative; border:1px solid #D8D8D8;}
#shadeblockOne{margin-left:1.5px; margin-top:2px; position:absolute; height:15px; width:85px;}
input.shadeOne{height:15px; width:85px;}
</style>
HTML
<div id=”colorShadesContainer”>
<div id=”colorShades”>
<div id=”shadeblockOne”><input type=”button” class=”shadeOne” value=”” title=”” /></div>
JavaScript
var RedTonesHtmlHex = new Array(30)
for (r=0; r < 30; r++)
RedTonesHtmlHex[r] = new Array(2)
RedTonesHtmlHex[0] = new Array(2)
RedTonesHtmlHex[0][0] = “#080000”
RedTonesHtmlHex[0][1] = “lightRed”
I just want to know how to populate these value into the button background colors. Any solutions, ideas, or samples much appreciated