change CSS definition by javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gerhard Hönig

    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">bl a bla</span>
    ...
    <span class="test">bl a bla</span>
    ...
    <span class="test">bl a 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

    #2
    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.deBoynePolla rd/FGA/questions-with-yes-or-no-answers.html>

    --
    Steve

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

    Comment

    • Matt Silberstein

      #3
      Re: change CSS definition by javascript

      On Fri, 13 May 2005 08:02:49 -0400, in
      comp.infosystem s.www.authoring.stylesheets , "Steve Fulton"
      <cerberus40@gee mail.com> in <op.sqpqej1ii0i x9l@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.deBoynePolla rd/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.

      Comment

      • Jean Pierre Daviau

        #4
        Re: change CSS definition by javascript

        Yes






        "Steve Fulton" <cerberus40@gee mail.com> a écrit dans le message de news:
        op.sqpqej1ii0ix 9l@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.deBoynePolla rd/FGA/questions-with-yes-or-no-answers.html>
        |
        | --
        | Steve
        |
        | Any sufficiently advanced technology is indistinguishab le from magic.
        | -Arthur C Clarke


        Comment

        • Safalra

          #5
          Re: change CSS definition by javascript

          Matt Silberstein wrote:[color=blue]
          > <cerberus40@gee mail.com> in <op.sqpqej1ii0i x9l@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.deBoynePolla rd/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)


          Comment

          • Safalra

            #6
            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:



            --
            Safalra (Stephen Morley)


            Comment

            • Gerhard Hönig

              #7
              Re: change CSS definition by javascript


              "Steve Fulton" <cerberus40@gee mail.com> wrote in message
              news:op.sqpqej1 ii0ix9l@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 indistinguishab le 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


              Comment

              • Gus Richter

                #8
                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

                Comment

                • Japes

                  #9
                  Re: change CSS definition by javascript

                  A solution is here:

                  Network Solutions - Original domain name registration and reservation services with variety of internet-related business offerings. Quick, dependable and reliable.


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

                  Comment

                  Working...