#1
  1. No Profile Picture
    Chocolate Junkie.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    19
    Rep Power
    0

    Unhappy


    G'day.

    say i have a <TD> right?
    im using this code to change the background right?

    OnMouseOver="Style.backgroundcolor='#000000';" OnMouseOut="Style.backgroundcolor='#FFFFFF';"

    ok that works ok.. ( i retyped it so its not exact )

    what about changing text colours in the cell ? if i can change the background colour of the cell i MUST be able to change the text right? help.. murder.. death.. any ideas ?

    whats the code.. Style.something or Style.td.something ?
    help

    Kai.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Florida
    Posts
    4
    Rep Power
    0
    you can do it like this: make two classes in your stylesheet something like menuon and menuoff.
    <style type="text/css">
    td.menuon { background-color: #000000; color: #FFFFFF; }
    td.menuoff { background-color: #FFFFFF; color: #000000; }
    </style>

    <td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';">
    </td>
  4. #3
  5. No Profile Picture
    Chocolate Junkie.
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    19
    Rep Power
    0

    THANK-YOU


    Thank you so much.. i've been awaiting an answer to my question.. thanks !!

    kaiilan.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Florida
    Posts
    4
    Rep Power
    0
    no problem just remember though that if you are using it for a navigation menu you need to add an onclick event. like this:
    onclick="location.href='/there.html';"
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    14
    Rep Power
    0
    Originally Posted by scmilk
    you can do it like this: make two classes in your stylesheet something like menuon and menuoff.
    <style type="text/css">
    td.menuon { background-color: #000000; color: #FFFFFF; }
    td.menuoff { background-color: #FFFFFF; color: #000000; }
    </style>

    <td class="menuoff" onmouseover="className='menuon';" onmouseout="className='menuoff';">
    </td>
    Hey, i've done it like this:

    <style type="text/css">
    td {
    background-color: green;
    color: lightblue;
    }
    td:hover {
    background-color: lightgreen;
    color: blue;
    }
    </style>

    I think this is less difficult..
  10. #6
  11. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,129
    Rep Power
    4304
    Welcome to DevShed Forums, Mika.

    Next time please don't post a comment to a thread that has been inactive for years.

    The reason JavaScript was used is that back in March 2001, IE6 hadn't even been released yet and versions of IE before 7 only support ":hover" on <a> elements. Also at that time IE had over 80% market-share and the majority of the remaining market-share was that of Netscape 4.x, which, as far as I remember, did not support that pseudo-class at all.
    Last edited by Kravvitz; May 27th, 2013 at 06:01 AM.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    14
    Rep Power
    0
    Originally Posted by Kravvitz
    Welcome to DevShed Forums, Mika. :
    Thanks!

    Originally Posted by Kravvitz
    Next time please don't post a comment to a thread that has been inactive for years.

    The reason JavaScript was used is that back in March 2001, IE6 hadn't even been released yet and versions of IE before 7 only support ":hover" on <a> elements. Also at that time IE had over 80% market-share and the majority of the remaining market-share was that of Netscape 4.x, which, as far as I remember, did not support that pseudo-class at all.
    Oh, i'm sorry.. did'nt know that :$

IMN logo majestic logo threadwatch logo seochat tools logo