SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    Canada
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Proprietary Class Properties

    Is it possible to make your own class properties. I want to refer to a property in the style sheet for ahighlight function I'm making.

    Code:
    onmouseover="this.bgColor=('#E5E1E1')" onmouseout="this.bgColor=(this.style.color)"
    As you can see, the mouseover has the highlight hardcoded, whereas the mouseout takes the original colour from the stylesheet.

    Can I make a poperty of the element I'm changing (a TD in this case) such as "swapcolor: #E5E1E1;"? I tried but the colour comes up green and I know that's not right.

    I also tried doing it like this but to no avail.
    Code:
     onmouseover="this.bgColor=(this.style.color + #222222)"
    If anyone has a better way of specifying the highlight colour without hardcoding it let me know.

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In IE only (AFAIK), you can create custom attributes:
    Code:
    <td id='r2c1' class='tblCell' hilite='ccf'>r2c1</td>
    
    alert('#' + document.getElementById('r2c1').hilite);
    Note that I'm talking about html 'attributes', not css 'properties'.


Bookmarks

Posting Permissions

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