Results 1 to 7 of 7

Thread: CSS question

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    CSS question

    hi,


    ok, heres my question.

    i have an "OnMouseOver" and an "OnMouseOut", and for each mouseover and mouse out, its the same sequece(change color)

    can i assign it to a "function", so that itll change the color, instead of having to put the code in each section?

    thanks
    nabeel

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    If you are only coding for IE you can use this:

    <style>

    a:hover { color:green; font-weight:bold; }

    </style>

    Again, this will only work for IE. The above style will work for all links on the page.
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Yeah, you can.

    Code:
    <script>
    function changecolor(id, color)
    {
        id.style.color = color;
    }
    </script>
    ...
    <span onMouseOver="changecolor(this,'red')" onMouseOut="changecolor(this,'black')">
    turns red on mouseover, black on mouseout
    </span>
    Alcohol & calculus don't mix.
    Never drink & derive.

  4. #4
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    I'm afriad you can't. 'Least I'm not finding anything in the CSS specs at W3C. I would like to do the same thing. It makes sense to me.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  5. #5

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    well, right now im using:
    Code:
    <td height="29" onMouseOver="style.backgroundColor='#CCCC99'; borderColor='#000000';" onMouseOut="style.backgroundColor='#F0F0E1'; borderColor='#F0F0E1';">
    and its for only a few cells, like ones in which the subject is. instead of copy and pasting that whole bit, i wanna just have it link. well if you cant do it that way then
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  6. #6

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    well, right now im using:
    Code:
    <td height="29" onMouseOver="style.backgroundColor='#CCCC99'; borderColor='#000000';" onMouseOut="style.backgroundColor='#F0F0E1'; borderColor='#F0F0E1';">
    and its for only a few cells, like ones in which the subject is. instead of copy and pasting that whole bit, i wanna just have it link. well if you cant do it that way then


    thanks
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  7. #7
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    You can make functions, like Wynd suggested, you just can't put this in CSS.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width