Connecting Tech Pros Worldwide Forums | Help | Site Map

change CSS definition by javascript

Gerhard Hönig
Guest
 
Posts: n/a
#1: Jul 21 '05
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



Steve Fulton
Guest
 
Posts: n/a
#2: Jul 21 '05

re: change CSS definition by javascript


Gerhard Hönig wrote:
[color=blue]
> 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?[/color]

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
Matt Silberstein
Guest
 
Posts: n/a
#3: Jul 21 '05

re: change CSS definition by javascript


On Fri, 13 May 2005 08:02:49 -0400, in
comp.infosystems.www.authoring.stylesheets , "Steve Fulton"
<cerberus40@geemail.com> in <op.sqpqej1ii0ix9l@steve> wrote:
[color=blue]
>Gerhard Hönig wrote:
>[color=green]
>> 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?[/color]
>
>Yes. <http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html>[/color]

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.
Jean Pierre Daviau
Guest
 
Posts: n/a
#4: Jul 21 '05

re: change CSS definition by javascript


Yes

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




"Steve Fulton" <cerberus40@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


Safalra
Guest
 
Posts: n/a
#5: Jul 21 '05

re: change CSS definition by javascript


Matt Silberstein wrote:[color=blue]
> <cerberus40@geemail.com> in <op.sqpqej1ii0ix9l@steve> wrote:[color=green]
> >Gerhard Hönig wrote:[color=darkred]
> >> [snip some CSS question]
> >> is that possible?[/color]
> >
> >Yes.[/color][/color]
<http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html>[color=blue]
>
> I am not the OP, but thanks for this link.[/color]

I doubt the OP will be thanking anyone...
[color=blue]
> 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.[/color]

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/

Safalra
Guest
 
Posts: n/a
#6: Jul 21 '05

re: change CSS definition by javascript


Gerhard Hönig wrote:[color=blue]
> i have a basic question on CSS.
> Is it possible to change the CSS class definition dynamically by[/color]
using[color=blue]
> Javascript.[/color]

See:

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

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

Gerhard Hönig
Guest
 
Posts: n/a
#7: Jul 21 '05

re: change CSS definition by javascript



"Steve Fulton" <cerberus40@geemail.com> wrote in message
news:op.sqpqej1ii0ix9l@steve...[color=blue]
> Gerhard Hönig wrote:
>[color=green]
> > 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?[/color]
>
> Yes.[/color]
<http://homepages.tesco.net/~J.deBoyn...th-yes-or-no-a
nswers.html>[color=blue]
>
> --
> Steve
>
> Any sufficiently advanced technology is indistinguishable from magic.
> -Arthur C Clarke[/color]

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


Gus Richter
Guest
 
Posts: n/a
#8: Jul 21 '05

re: change CSS definition by javascript


Gerhard Hönig wrote:[color=blue]
> 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)[/color]

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

Japes
Guest
 
Posts: n/a
#9: Jul 21 '05

re: change CSS definition by javascript


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.

Closed Thread