473,385 Members | 1,474 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,385 software developers and data experts.

change CSS definition by javascript

Hi,

i have a basic question on CSS.
Is it possible to change the CSS class definition dynamically by using
Javascript.

example:
ich have a css class like this one:

..test {
color: red;
}

and some HTML tags like

<span class="test">bla bla</span>
...
<span class="test">bla bla</span>
...
<span class="test">bla bla</span>

and now ic would have a link/button to click and then change the color
attribute in class test to blue with Javascript (means without reloading
page and changing it on the server)

is that possible?

thanks.

gerhard
Jul 21 '05 #1
8 64353
Gerhard Hönig wrote:
i have a basic question on CSS.
Is it possible to change the CSS class definition dynamically by using
Javascript.

example:
ich have a css class like this one:

.test {
color: red;
}

and now ic would have a link/button to click and then change the color
attribute in class test to blue with Javascript (means without reloading
page and changing it on the server)

is that possible?


Yes. <http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html>

--
Steve

Any sufficiently advanced technology is indistinguishable from magic.
-Arthur C Clarke
Jul 21 '05 #2
On Fri, 13 May 2005 08:02:49 -0400, in
comp.infosystems.www.authoring.stylesheets , "Steve Fulton"
<ce********@geemail.com> in <op.sqpqej1ii0ix9l@steve> wrote:
Gerhard Hönig wrote:
i have a basic question on CSS.
Is it possible to change the CSS class definition dynamically by using
Javascript.

example:
ich have a css class like this one:

.test {
color: red;
}

and now ic would have a link/button to click and then change the color
attribute in class test to blue with Javascript (means without reloading
page and changing it on the server)

is that possible?


Yes. <http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html>


I am not the OP, but thanks for this link. It should come in two
versions, though. One with a big "YES" and one with a big "NO". Then
you could give one or the other link as the answer.
--
Matt Silberstein

All in all, if I could be any animal, I would want to be
a duck or a goose. They can fly, walk, and swim. Plus,
there there is a certain satisfaction knowing that at the
end of your life you will taste good with an orange sauce
or, in the case of a goose, a chestnut stuffing.
Jul 21 '05 #3
Yes

http://www.dannyg.com/pubs/index.html


"Steve Fulton" <ce********@geemail.com> a écrit dans le message de news:
op.sqpqej1ii0ix9l@steve...
| Gerhard Hönig wrote:
|
| > i have a basic question on CSS.
| > Is it possible to change the CSS class definition dynamically by using
| > Javascript.
| >
| > example:
| > ich have a css class like this one:
| >
| > .test {
| > color: red;
| > }
| >
| > and now ic would have a link/button to click and then change the color
| > attribute in class test to blue with Javascript (means without reloading
| > page and changing it on the server)
| >
| > is that possible?
|
| Yes.
<http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html>
|
| --
| Steve
|
| Any sufficiently advanced technology is indistinguishable from magic.
| -Arthur C Clarke
Jul 21 '05 #4
Matt Silberstein wrote:
<ce********@geemail.com> in <op.sqpqej1ii0ix9l@steve> wrote:
Gerhard Hönig wrote:
[snip some CSS question]
is that possible?
Yes.

<http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html>
I am not the OP, but thanks for this link.
I doubt the OP will be thanking anyone...
It should come in two
versions, though. One with a big "YES" and one with a big "NO". Then
you could give one or the other link as the answer.


Isn't this more than a little evil? Implicit questions are a major
feature of English (at least in Britain - maybe everyone else is more
direct?) and we'd never get anywhere if people insisted on taking
everything literally...

--
Safalra (Stephen Morley)
http://www.safalra.com/science/linguistics/

Jul 21 '05 #5
Gerhard Hönig wrote:
i have a basic question on CSS.
Is it possible to change the CSS class definition dynamically by using Javascript.


See:

http://www.faqts.com/knowledge_base/...d/2147/fid/128

--
Safalra (Stephen Morley)
http://www.safalra.com/hypertext/

Jul 21 '05 #6

"Steve Fulton" <ce********@geemail.com> wrote in message
news:op.sqpqej1ii0ix9l@steve...
Gerhard Hönig wrote:
i have a basic question on CSS.
Is it possible to change the CSS class definition dynamically by using
Javascript.

example:
ich have a css class like this one:

.test {
color: red;
}

and now ic would have a link/button to click and then change the color
attribute in class test to blue with Javascript (means without reloading
page and changing it on the server)

is that possible?
Yes.

<http://homepages.tesco.net/~J.deBoyn...th-yes-or-no-a
nswers.html>
--
Steve

Any sufficiently advanced technology is indistinguishable from magic.
-Arthur C Clarke


Hi Steve,

thanks lot for this little lesson in english semantics
I'll try to remember ist when perhaps I will find any of yours questions
:-))

gerhard
/o
Jul 21 '05 #7
Gerhard Hönig wrote:
Hi,

i have a basic question on CSS.
Is it possible to change the CSS class definition dynamically by using
Javascript.

and now ic would have a link/button to click and then change the color
attribute in class test to blue with Javascript (means without reloading
page and changing it on the server)


See the discussion on "Alternate style sheets" 4/24/05.
You may be interested in my link of an example/demo.
I used onmouseover but onclick may be used if desired.

--
Gus

Jul 21 '05 #8
A solution is here:

http://www.projectseven.com/extensio...lass/index.htm

Great if you use Dreamweaver, very useable, but a little more work if
you dont.

Jul 21 '05 #9

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

Similar topics

2
by: Christian Kusenbach | last post by:
Hello group! I've a problem with JavaScript and IMG-Objects. On my webpage I use a big image and several small images. If you click on a small image, it executes a JavaScript to change the...
12
by: techie | last post by:
Hi All, I have a portal working on an intranet for a company. The portal was designed keeping in mind the resolution of 1024*768. I am including a ..css file in all the files. Now i have to make...
3
by: Catherine Lynn Smith | last post by:
I am creating a webpage with dhtml <DIV> layers and I want a link on one layer to modify the content on another but I seem to keep running into errors. Basically I create a layer in the middle...
9
by: Nick | last post by:
I have the following code, and it works well on Mozilla 1.6. (However, the image src property cannot be set on Mozilla 1.2.1). Unfortunately, all the code: document.images.itemImage.src =...
0
by: Jimmy Cerra | last post by:
I recently came up with a cool little stylesheet for definition lists. There is a small demostration for the impatient . I hope this helps someone. Here's how I did it. Definition lists are...
2
by: Pete Kipe | last post by:
I'm not a JavaScript programmer...but I'm trying to put together a simple menu system for a new website and need a little help. I have the following script: <SCRIPT language=javascript> <!--...
3
by: Gerhard Hönig | last post by:
Hi, i have a basic question on CSS. Is it possible to change the CSS class definition dynamically by using Javascript. example: ich have a css class like this one: ..test {
3
dmjpro
by: dmjpro | last post by:
Today i encountered a typical thing. So far what i knew that JavaScript had a scope inside a function but it was not there. I think in newer version of JavaScript it is introduced, in older version...
15
by: Sunny | last post by:
Hi, I can change the lement opacity in IE using. abc.style.filter = 'alpha(opacity=' + 10 + ')'; But this dont work in firefox, In firefox it throws error. How I can change the opacity of an...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...

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.