#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    164
    Rep Power
    12

    javascript functions in style.css - possible?


    Hello everyone,

    I use javascript OnMouse events to make rolling over my tables dynamic.. and the same code gets used for each part of each table.. and its starting to make the size of the pages big

    heres an example:

    Code:
        <tr> 
          <td onMouseOut="javascript:this.style.background='#A7ADB7'" onMouseOver="javascript:this.style.background='#959EAD'" class=menu>____<a href="#>blahh</a></td>
        </tr>
    I was wondering if there was anyway i could make it smaller, so that it doesnt need writing each time, like maybe put this in a style.css file - but im not sure if such events work that way

    Any ideas would be muchly appreciated,
    All the best

    -BP-
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    164
    Rep Power
    12
    Is there anyway someone could try and show some examples, ive read the link given and found another but still not having any joy with this,

    All ive managed to get the text part of a link to change colour through CSS but no luck with doing like i want with the table

    Could really do with some help here : )

    Thanks for your time,
    -BP-
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    164
    Rep Power
    12
    Ok i think ive done it : )

    Ive added this to the CSS file:
    Code:
    td:hover { background: #959EAD }
    Which seems to work fine

    What im wondering now though, is this multi-platform browser compatible, it seems to work pretty well on all the browsers ive tried on except for InternetExplorer .. is there anything i can do to make it work 100% ?

    Thanks,
    -BP-
    Last edited by Battery Powered; June 10th, 2003 at 04:19 AM.
  8. #5
  9. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    The hover pseudo-class is only supported for link elements in Microsoft browsers. You'll need to use links for cross-browser support. Try some of these links (many examples):

    http://www.google.com/search?hl=en&i...ollovers+hover

IMN logo majestic logo threadwatch logo seochat tools logo