Ross
eCreations Staff
Posts: 1,768
|
Post by Ross on Oct 5, 2005 20:54:58 GMT
Global FooterThis will do two things. Firstly, it'll let you add more colors to the drop down menu. And secondly, it'll make all the colors in the drop down menu the same color as the name. Eg, 'Blue' will be blue. <script type="text/javascript"> <!-- var color=[]; color[0]=["CC0066","Hot Pink"] color[1]=["FF3366","Another Color"]
if(document.postForm){ var select=document.getElementsByTagName('select'); for (m=0;m<select.length;m++) if(select[m].name=="color") { for(e=0;e<color.length;e++) { var re=document.createElement('option') re.style.color=color[e][0]; re.value = color[e][0]; re.appendChild(document.createTextNode(color[e][1])); select[m].appendChild(re); } var option=select[m].getElementsByTagName('option'); for(c=0;c<option.length;c++) { if(option[c].value) { option[c].style.color=option[c].value; } } } } //--> </script> Edit the lines which look like this: color[0]=["CC0066","Hot Pink"] color[1]=["FF3366","Another Color"] color[X]=["HEX Color","Color Name "]Where X increases by one each time
|
|
g0alieb0y
Junior Member
My Squiggle ~~~ !
Posts: 79
|
Post by g0alieb0y on Oct 6, 2005 0:01:12 GMT
Good code. You should make a v2 so we can also remove colors
|
|