...

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



Fumigator
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;
alert(x);

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?

Fumigator
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?

_Aerospace_Eng_
12-20-2005, 12:06 AM
http://radio.javaranch.com/pascarello/2005/05/19/1116513366466.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum