FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Javascript Color Pallet

 


moejoe
Hey does anyone know of a Tutorial that has a color selector similar to the one on Google Adsence?

It needs to be easy to update. So im hoping the JS would be similar to:

Code:
var table = document.getElementById("table_Id");
    var td = table.getElementsByTagName("td");
         var color = td.style.backgroundColor;


I need the function to call the Var Color to A Text Feild and to alter the Background Color of "table_id"

Any Ideas?
LukeakaDanish
Tell me if i have understood you correctly:

You want a pallette which generates itself onload
You want a paragraph which the user can control the appearance of using this palette


If this is what you want it should be very simple to write - just think about having a function which is passed "this" and then takes the style.backgroundColor attribute of "this" and gives it to the paragraph element
moejoe
Its like the Google Adsence color pallet.
When you click on "Choose Color" a box apears where you can select colors.

Then when you hover over a <td> of the table the <td> backgroundColor gets read and copied to a text feild.

Then the Textfeild's #color is read and the color is applied to the Preview Table.

Thanks
LukeakaDanish
Ok...this couldnt be much more simple...

When your writing the td's (i asume you are already capable of that), write onclick to "setColor(this);"

The setColor(elem) function could then do something like this:

bg_color = elem.style.backgroundColor;
document.getElementById('paragraph').style.color = bg_color;

- I think that pretty much it!
moejoe
Hey,
I found a website that has a DHTML script like that.
And i know some javascript so i could make the table color change acordingly.

It's A nifty little script i downloaded here:
http://www.dhtmlgoodies.com/scripts/js_color_picker_v2/js_color_picker_v2.html

Thanks For Your Help
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.