469,330 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

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 64093
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Christian Kusenbach | last post: by
3 posts views Thread by Catherine Lynn Smith | last post: by
reply views Thread by Jimmy Cerra | last post: by
2 posts views Thread by Pete Kipe | last post: by
3 posts views Thread by Gerhard Hönig | last post: by
15 posts views Thread by Sunny | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.