![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Here is the form and div snippet form <form name="myForm" div id="myDiv" { background-color: #9900FF; } /div /form |
|
how do I dynamically change the color to #FF85AA, or any other hex number??? |
#3
| |||
| |||
|
|
how do I dynamically change the color to #FF85AA, or any other hex number??? Ignoring the obvious errors... |
#4
| |||
| |||
|
|
On Fri, 20 Jan 2006 22:07:05 GMT, "News" <warren (AT) no_S_P_A_M_wyght (DOT) com wrote: Here is the form and div snippet form <form name="myForm" div id="myDiv" { background-color: #9900FF; } /div /form What's this? A DIV element filled with content that /looks/ like CSS? how do I dynamically change the color to #FF85AA, or any other hex number??? There is no /color/ specified, just ordinary text. -- Rex |
#5
| |||
| |||
|
|
News wrote: how do I dynamically change the color to #FF85AA, or any other hex number??? Ignoring the obvious errors... There is no way to do so with either HTML or CSS. -- jmm (hyphen) list (at) sohnen-moe (dot) com (Remove .AXSPAMGN for email) |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
var c=16777215;//= = "FFFFFF" HEX |
|
snippet in a javascript function document.getElementById('tested').style.background Color="#"+c.toString (16).toUpperCase(); |
#8
| |||
| |||
|
|
how do I dynamically change the color to #FF85AA, or any other hex number??? There is no way to do so with either HTML or CSS. Yes there is No, there is not. The solution you found is Javascript that uses DOM to |
#9
| |||
| |||
|
|
News wrote: how do I dynamically change the color to #FF85AA, or any other hex number??? There is no way to do so with either HTML or CSS. Yes there is No, there is not. The solution you found is Javascript that uses DOM to change the color. That is neither HTML nor CSS. -- jmm (hyphen) list (at) sohnen-moe (dot) com (Remove .AXSPAMGN for email) |
#10
| |||
| |||
|
|
On 2006-01-23, News <warren (AT) no_S_P_A_M_wyght (DOT) com> wrote: var c=16777215;//= = "FFFFFF" HEX you can also do var c=0xffffff; // white where hex notation is more convenient snippet in a javascript function document.getElementById('tested').style.background Color="#"+c.toString (16).toUpperCase(); this however will only work correctly where c < 0xfffff for obvious reasons... it's not that hard to fix. in many cases if may be more convenint to do document.getElementById('tested').style.background Color="#FFFFFF" AIUI hex colours in stylesheets aren't case sensitive. #FFF ia equivalent to #fff -- Bye. Jasen |
![]() |
| Thread Tools | |
| Display Modes | |
| |