HighDots Forums  

<div>

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss <div> in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
News
 
Posts: n/a

Default <div> - 01-20-2006 , 04:07 PM






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



Reply With Quote
  #2  
Old   
Jan Roland Eriksson
 
Posts: n/a

Default Re: <div> - 01-21-2006 , 04:15 AM






On Fri, 20 Jan 2006 22:07:05 GMT, "News" <warren (AT) no_S_P_A_M_wyght (DOT) com>
wrote:

Quote:
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?

Quote:
how do I dynamically change the color to #FF85AA, or any other hex number???
There is no /color/ specified, just ordinary text.

--
Rex




Reply With Quote
  #3  
Old   
Jim Moe
 
Posts: n/a

Default Re: <div> - 01-21-2006 , 04:13 PM



News wrote:
Quote:
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)


Reply With Quote
  #4  
Old   
News
 
Posts: n/a

Default Re: <div> - 01-23-2006 , 04:22 PM




"Jan Roland Eriksson" <jrexon (AT) newsguy (DOT) com> wrote

Quote:
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


Yes there is




Reply With Quote
  #5  
Old   
News
 
Posts: n/a

Default Re: <div> - 01-23-2006 , 04:33 PM




"Jim Moe" <jmm-list.AXSPAMGN (AT) sohnen-moe (DOT) com> wrote

Quote:
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)
Yes there is





Reply With Quote
  #6  
Old   
News
 
Posts: n/a

Default Found it - 01-23-2006 , 04:34 PM



var c=16777215;//= = "FFFFFF" HEX

snippet in a javascript function

document.getElementById('tested').style.background Color="#"+c.toString
(16).toUpperCase();



Reply With Quote
  #7  
Old   
Jasen Betts
 
Posts: n/a

Default Re: Found it - 01-24-2006 , 03:44 AM



On 2006-01-23, News <warren (AT) no_S_P_A_M_wyght (DOT) com> wrote:
Quote:
var c=16777215;//= = "FFFFFF" HEX
you can also do

var c=0xffffff; // white

where hex notation is more convenient

Quote:
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


Reply With Quote
  #8  
Old   
Jim Moe
 
Posts: n/a

Default Re: <div> - 01-24-2006 , 10:35 AM



News wrote:
Quote:
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)


Reply With Quote
  #9  
Old   
News
 
Posts: n/a

Default Re: <div> - 01-24-2006 , 11:23 AM




"Jim Moe" <jmm-list.AXSPAMGN (AT) sohnen-moe (DOT) com> wrote

Quote:
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)
Grief I don't understand, I thought that JavaScript was using CSS to change
the color. What then is happening?




Reply With Quote
  #10  
Old   
News
 
Posts: n/a

Default Re: Found it - 01-24-2006 , 11:26 AM




"Jasen Betts" <jasen (AT) free (DOT) net.nz> wrote

Quote:
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
To be sure I understand, 0x before the number makes it a Hex number,
correct?







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.