[Javascript] Hex values and RGB values?

Skip Evans skip at bigskypenguin.com
Sat Jun 14 18:47:15 CDT 2008


Hey all,

I'm using a color selector and a form value to 
assign values to things like the following:

document.getElementById('matte').style.background=form.color.value;

Where the form contains things like '#FFFF00'.

Next, I want to save these values chosen in a 
database, but when I do the following:

var 
color=document.getElementById('matte').style.background;
alert(color);

I am getting the following in the alert box 
instead of the Hex value:

rgb(255, 255, 0) none repeat scroll 0% 0%

"D'oh!"

How can I get the hex value from

document.getElementById('matte').style.background

??????

This was MOST unexpected!

Thanks,
Skip
-- 
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX & DHTML development framework.
http://phpenguin.bigskypenguin.com/



More information about the Javascript mailing list