473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

<div>

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???
Jan 20 '06 #1
11 1747
On Fri, 20 Jan 2006 22:07:05 GMT, "News" <warren@no_S_P_A_M_wyght.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
Jan 21 '06 #2
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)
Jan 21 '06 #3

"Jan Roland Eriksson" <jr****@newsguy.com> wrote in message
news:ov********************************@4ax.com...
On Fri, 20 Jan 2006 22:07:05 GMT, "News" <warren@no_S_P_A_M_wyght.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
Jan 23 '06 #4

"Jim Moe" <jm***************@sohnen-moe.com> wrote in message
news:aa********************@giganews.com...
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

Jan 23 '06 #5
var c=16777215;//= = "FFFFFF" HEX

snippet in a javascript function

document.getElementById('tested').style.background Color="#"+c.toString
(16).toUpperCase();
Jan 23 '06 #6
On 2006-01-23, News <warren@no_S_P_A_M_wyght.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
Jan 24 '06 #7
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)
Jan 24 '06 #8

"Jim Moe" <jm***************@sohnen-moe.com> wrote in message
news:St********************@giganews.com...
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?
Jan 24 '06 #9

"Jasen Betts" <ja***@free.net.nz> wrote in message
news:16*****************@clunker.homenet...
On 2006-01-23, News <warren@no_S_P_A_M_wyght.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?

Jan 24 '06 #10
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.

Grief I don't understand, I thought that JavaScript was using CSS to change
the color. What then is happening?

Javascript is accessing the DOM (Document Object Model) and changing its
properties. See <http://www.w3.org/DOM/>.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jan 25 '06 #11

"Jim Moe" <jm***************@sohnen-moe.com> wrote in message
news:Jt******************************@giganews.com ...
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.

Grief I don't understand, I thought that JavaScript was using CSS to
change
the color. What then is happening?

Javascript is accessing the DOM (Document Object Model) and changing its
properties. See <http://www.w3.org/DOM/>.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Thanks for your help Jim, I have heaps to learn ;-)
Jan 26 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to...
1
by: Philo | last post by:
How do I select all <div> tags except those which contain a <table> tag somewhere within them? Example XML: <********************** sample input ***********************> <txtSectionBody>...
3
by: Paul Thompson | last post by:
When I put a <div ...> inside a <table> specification, functionality is not there. When I put the <table> inside the <div> everything works. Why is that?
8
by: Daniel Hansen | last post by:
I know this must seem totally basic and stupid, but I cannot find any reference that describes how to control the spacing between <p>...</p> and <div>...</div> blocks. When I implement these on a...
8
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is...
6
by: Marcus Otmarsen | last post by:
Ok, the situation is as follows: I defined a <DIV> like: <div id="myid" style="position: absolute; height: 10; width: 10;"><img src="images/object.gif" height=10 width=10></div> This pane is...
3
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644"...
28
by: Kent Feiler | last post by:
1. Here's some html from a W3C recommendations page. <P>aaaaaaaaa<DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</DIV> 2.Although I didn't think it would make any difference, I tried it with the...
5
by: Agix | last post by:
Hi there, Please check out : http://clarifysolutions.co.uk/certenroll/ The source is included below. This page is a test, so I can play about with paddings, margins and layouts using divs as...
8
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.