#1
  1. Ultimate Gamer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    London
    Posts
    9
    Rep Power
    0

    Question css row colour mouseover change


    Hi,

    I have found this code in a php thing of mine and I would like to change it, and this bit off css is what makes it "happen". As it stands, when you mouse over a row nothing happens. What I would like it to do is change colour of the whole row (rows 1-4) (Like in phpMyAdmin browse section). This is the code I think I should change:

    Code:
    /* Common elements */
    .row1 { background-color: #F5F9FD }
    .row2 { background-color: #DFE6EF }
    .row3 { background-color: #EEF2F7 }
    .row4 { background-color: #E4EAF2 }
    I also have this bit of CSS that can change ONE row's colour, but not all of them at the same time. If it helps, this is the code. I have edited the code into the main php file I have, in all the rows, but it only changes one "cell" when you hover over it, and not the whole row.
    Code:
    <td class="row4" onmouseover='window.status="{$info['name']}"; 
    this.style.backgroundColor=iOver;' onmouseout='window.status="Done"; 
    this.style.backgroundColor=iOut;' onclick="javascript:window.location.href='{$ibforums->base_url}showforum={$info['id']}';">;
    </td>
    </span></td>
    Thanks,

    Prism128

    PS: The iOver and iOut (in the second code) are colour references in a php file
  2. #2
  3. No Profile Picture
    Standards User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    146
    Rep Power
    12
    It only changes the cell because the css is applied to the <td> if you apply it to the <tr> instead, it should work.
  4. #3
  5. Ultimate Gamer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    London
    Posts
    9
    Rep Power
    0

    Thumbs up thanks


    k, thanks mate, will try.

    Prism128
  6. #4
  7. Ultimate Gamer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    London
    Posts
    9
    Rep Power
    0

    Thumbs down


    i have tried it but to no avail. this is the code i put in:
    Code:
    function ForumRow($info) {
    global $ibforums;
    return <<<EOF
            <tr this.style.backgroundColor=iOver;' this.style.backgroundColor=iOut;' onclick="javascript:window.location.href='{$ibforums->base_url}showforum={$info['id']}';"    > 
              <td class="row4" align="center">{$info['img_new_post']}</td>
              <td class="row4"><b><a href="{$ibforums->base_url}showforum={$info['id']}">{$info['name']}</a></b><br /><span class='desc'>{$info['description']}<br />{$info['moderator']}</span></td>
              <td class="row2" align="center">{$info['topics']}</td>
              <td class="row2" align="center">{$info['posts']}</td>
              <td class="row2" nowrap="nowrap">{$info['last_post']}<br />{$ibforums->lang['in']}:&nbsp;{$info['last_unread']}{$info['last_topic']}<br />{$ibforums->lang['by']}: {$info['last_poster']}</td>
            </tr>
    EOF;
    }
    Prism128

    BTW: any text with $ before it is my php language, as well as the things like: ['posts'] etc
    Last edited by Prism128; February 23rd, 2004 at 02:13 PM.
  8. #5
  9. Ultimate Gamer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    London
    Posts
    9
    Rep Power
    0
    Someone please answer!!

    Prism128
  10. #6
  11. macho member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    207
    Rep Power
    12
    you were so close ...

    <tr class="row4" onmouseover='window.status="{$info['name']}";
    this.style.backgroundColor=iOver;' onmouseout='window.status="Done";
    this.style.backgroundColor=iOut;' onclick="java_script_:window.location.href='{$ibforums->base_url}showforum={$info['id']}';">;

    <td>
    cell 1
    </td>

    <td>
    cell 2
    </td>

    </tr>

    INF waz raite

    I've done this b4, know it works, ciao
  12. #7
  13. Ultimate Gamer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    London
    Posts
    9
    Rep Power
    0
    thanks alot mate!! il try it in 1/2 hour (when ive done some work) and let u know.

    thanks again,

    Prism128
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    56
    Rep Power
    11
    And make sure that the css property 'background-color' is not being set on <td>'s generally at all (not even to transparent), it needs to be set to 'inherit' (which is the default if not changed).
  16. #9
  17. Ultimate Gamer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    London
    Posts
    9
    Rep Power
    0

    Post


    I copied the code into the right place, but it still doesn't work.
    however, there was an extra semi-colon that makes an extra
    line appear above the table. this showed me that it was "semi-working"
    Here is a flash-in-a-zip file for you to see. 288KB.

    http://cty.hopto.org/help/forums.zip

    Thanks for the help so far, I feel that the end isn't far off!!

    Prism128
  18. #10
  19. macho member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    207
    Rep Power
    12
    ; semicolon found (**red** below)

    <tr class="row4" onmouseover='window.status="{$info['name']}"; this.style.backgroundColor=iOver;' onmouseout='window.status="Done"; this.style.backgroundColor=iOut;' onclick="java_script_:window.location.href='{$ibforums->base_url}showforum={$info['id']}';">***;***
    You can also turn the cursor to a hand by using
    this.style.cursor='pointer'

    more here
    http://www.htmlcenter.com/tutorials/...ls.cfm/55/CSS/
  20. #11
  21. Ultimate Gamer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    London
    Posts
    9
    Rep Power
    0
    I know where the semi-colon is/was, i just left it there to show that the code "works". If i take out THAT semi-colon, nothing happens. However, I will follow the link you just gave me. Thanks.

    Prism128

    PS. Thanks for the pointer, I will add it when i have read the linked page!!

    Thanks again for your help
  22. #12
  23. macho member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    207
    Rep Power
    12
    Sorry for pointing out the obvious ... i'm goofing of from work a little too much ...

    all the best!

IMN logo majestic logo threadwatch logo seochat tools logo