473,397 Members | 2,099 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,397 software developers and data experts.

how to change cor of all elements of some class

I have class defined in CSS

<style>
..bigone {color:red;}
</style>

and html like

<span class=bigone>test1</span>
<span class=bigone>test2</span>
....

Is it possible to change dinamically using javaScript color of all elements
of class bigone to blue?

thanks,
Nikolay.
Jul 20 '05 #1
2 2102
On Wed, 25 Aug 2004 16:53:50 +0400, Nikolay I.Nikolskiy <ni*@tepkom.ru>
wrote:
I have class defined in CSS

<style>
.bigone {color:red;}
</style>

and html like

<span class=bigone>test1</span>
<span class=bigone>test2</span>
...

Is it possible to change dinamically using javaScript color of all
elements
of class bigone to blue?

thanks,
Nikolay.


Why would you want this? I'm really confused. You realize that
no-Javascript UAs will not get the change? If the class won't have the
color in the stylesheet, then why set it at all?

Finally, why not do it server-side with some PHP which puts in the head
<style type="text/css">.bigone{color:blue}</style> ? Doing it client-side
with Javascript isn't as smart as doing it on the server.

A test page URL would be useful.
Jul 20 '05 #2
Nikolay I.Nikolskiy wrote:
I have class defined in CSS

<style>
.bigone {color:red;}
</style>

and html like

<span class=bigone>test1</span>
<span class=bigone>test2</span>
...

Is it possible to change dinamically using javaScript color of all elements
of class bigone to blue?


Of course, but this is more of a javascript question than a css one. The
safest way to do this is by defining a new class, and changing the
className with javascript, e.g., onload.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3

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

Similar topics

6
by: Csaba2000 | last post by:
How do I detect when the font size has been changed (especially by user action: either Ctrl+Scroll wheel or View/Text Size)? This is just for use on IE 5.5+, but it would be great if there was a...
14
by: Reply Via Newsgroup | last post by:
Folks, Say I have a table, ten columns, ten rows - Each with a word in it. I want to change the values of some/all of the cells in the table via a hyperlink. How do I reference each cell and...
3
by: Noozer | last post by:
I have several tags on a webpage of the same class. If the user clicks a specific checkbox I'd like to be able to alter the display property of the class, affecting all objects of that class. ...
2
by: Daniel Lidström | last post by:
Hi, I would like to know the cleanest way to change the serialization of my Line class from: <Line staStart="2327.02" length="10.00000003390744"> <End>549016.570965 57945.741122</End>...
1
by: libsfan01 | last post by:
can u change the display properties of elements in a certain class?
2
by: mkppk | last post by:
I have kind of strange change I'd like to make to the sets.Set() intersection() method.. Normally, intersection would return items in both s1 and s2 like with something like this: ...
0
by: marknoten | last post by:
Hi, we are working with XML files that can be as big as 6Mb. Some XML documents that obey to a certain condition must be duplicated where only 2 elements need to change value. I thought using...
2
by: Shannon | last post by:
Hello, thank you for taking the time to read this. I am totally stumped on this one. I have a ton of TD attributes that have to be changed based on the data in the DB. All TD elements are ID...
4
by: TAL651 | last post by:
Hello, Here's the challenge I'm trying to solve: I'd like, when I click a button on a page, that it causes the style for all elements of a certain class to change. When I click the button...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.