www.webdeveloper.com
Results 1 to 6 of 6

Thread: Ok.. cell background change

  1. #1
    Join Date
    Dec 2002
    Posts
    39

    Ok.. cell background change

    Say I have these 2 styles...

    td.mainmenu {
    font-size: 7pt;
    font-family: arial, sans-serif;
    background: #ffffff;
    color: #0000ff;
    text-decoration: none;
    }

    td.mainmenu2 {
    font-size: 7pt;
    font-family: arial, sans-serif;
    background: #6699cc;
    color: #ffffff;
    text-decoration: none;
    }

    And then the following code:

    PHP Code:
    print("<tr><td class='mainmenu'>
    <a href='index.php?content=mainmenu'>
    Main Menu</a></td></tr>"
    ); 
    What I am trying to do is switch between the styles .. Would this be done with onmouseover and onmouseout? I know by incorporating those into the <TD> declaration I can change one atribute.. but no matter what I do, I cant figure out how to change the styles.... HELP!

    ex:

    <td onmouseover="this.style.background='green';" onmouseout="this.style.background='#ffffff';" align="center">This cell will turn green</td>



    So, hows it done???

    Feel free to strip the print(" off of it.. my entire site is database driven using php, and I was just too lazy to strip it myself...

    And before anyone yells, The search isnt returning anything, although im sure this has been answered before... But Im not finding it....
    Last edited by cdxrevvved; 03-14-2003 at 11:08 PM.

  2. #2
    Join Date
    Dec 2002
    Posts
    39
    Styles used:

    PHP Code:
    td.mainmenu {
        
    font-size7pt;
        
    font-familyarialsans-serif;
        
    background#ffffff;
        
    }

    td.mainmenu2 {
        
    font-size7pt;
        
    font-familyarialsans-serif;
        
    background#0099ff;
        
    font-weightbold;
        
    text-decorationnone;
        
    color#ffffff;
        
    }


    A:hover.mainmenu {
    color#ffffff;
    font-weightbold;
    text-decorationnone;


    A:visited.mainmenuA:link.mainmenuA:active.mainmenu {
    color#6699cc;
    font-weightnormal;
    text-decorationnone;

    Using those styles,

    Code:
    <table>
    <tr>
    <td class='mainmenu' onmouseover="this.className='mainmenu2';"
    onmouseout="this.className='mainmenu';">
    <a class='mainmenu' href='index.php?content=mainmenu'>
    TESTING
    </a>
    </td></tr></table>
    ok now that successfully changes the background of the cells.

    the problem is, once a link is clicked, it goes to the visted color, 6699cc. This is fine.. But when I move the mouse into that cell again, the link is still that color. I need it to switch back to the bold, white...

    Any ideas? Its probably so simple too.... UGH!!!


    *Both posts edited for readability
    Last edited by cdxrevvved; 03-14-2003 at 11:09 PM.

  3. #3
    Join Date
    Jan 2003
    Location
    Atlanta, GA
    Posts
    571
    Change the order of hover and link.
    Instead of
    A:hover.mainmenu {...}
    A:visited.mainmenu, A:link.mainmenu, A:active.mainmenu {...}
    use the following
    A:visited.mainmenu, A:link.mainmenu, A:active.mainmenu {...}
    A:hover.mainmenu {...}

  4. #4
    Join Date
    Dec 2002
    Posts
    39
    if its that simple, im going to scream....

  5. #5
    Join Date
    Dec 2002
    Posts
    39
    *** EXTREMELY LOUD EAR PIERCING SCREAM ***

    And I've been beating my head against the desk all night trying to figure this out....

  6. #6
    Join Date
    Mar 2003
    Posts
    32
    DUDE YOU RAWK!!!!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles