View Full Version : Can I cast the value of style.backgroundColor to a hex value?

12-18-2005, 07:52 AM
I need to get the hex color value of the background color of a form element-- a text box.

If I do this:

var x = 0;
x = document.form1.ColorBox.style.backgroundColor;

I get "rgb(255, 0, 0)".

I want to get "#FF0000". Is there a way to cast this rgb value to hex? I mean without having to parse the dang thing?

12-19-2005, 11:46 PM
No one knows the answer to this hmm? Or do I need to rephrase what I'm talking about because I made no sense?

12-20-2005, 12:06 AM