Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 04, 2007 09:02 AM by xiaobing
Dec 04, 2007 03:06 AM|LINK
When I click on a <td style="background-color:#CCCCFF">, a table's bgcolor will change to the <td>'s bgcolor, a Textbox's bgcolor will change to the <td>'s bgcolor and display the color's value[example=rgb(204, 204, 255)
] .(actually what I want to display is the Hex code)
now, I need to get the value separately (int r = R, int g=G, int b = B). I need get the correct color to set a Html table bgcolor for email purpose.
I've tried to display the value by Textbox1.BackColor.R.ToString(); but it always show "0" value.
Please help~ Thanks.
part of the the js script:
document.getElementById(Table1).style.backgroundColor = td.style.backgroundColor;
document.getElementById(Textbox1).style.backgroundColor = td.style.backgroundColor;
document.getElementById(Textbox1).value = td.style.backgroundColor;
Dec 04, 2007 04:21 AM|LINK
I have some functions here that will do it for you:
Dec 04, 2007 09:02 AM|LINK
You are right, when I test at IE, it display hex code and everything work well.
But I still don't know how to split the rgb value (I don't want it display as "rgb(255, 255, 255)")
When I use color name, it works at both IE and Firefox, but it is not so effective way.