SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Pacific NW
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question calling css from within javascript

    Is there a way to change the button colors with css? I also need to do it for this.style.background on both mouseout and mouseover. Thanks!

    FYI - ignore the psx tags... they are for a CMS.

    Code:
     <xsl: output method="xml" omit-xml-declaration="yes" indent="yes" />
    <html>
    <head>
    <title> psx-title </title>
    <body>
    <form name="psx-catformname" style="border=none;" >
      <input type="button" onMouseOut="this.style.color='#000000'"
      onMouseOver="this.style.color='#555555'"
      style="borderStyle:none;border: none; "
      onClick="changeurl(this.form)" name="psx-title" value="psx-displayname">
      <input type="hidden" name="bottomurl" value="psx-catwsubnavlinkurl">
      <input type="hidden" name="topurl" value="psx-cattopurl">
    </form>
    </body>
    </html>

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You mean like this?

    onMouseOver="this.style.color='#555555';this.style.backgroundColor='#CCCCCC';"

    ??
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Pacific NW
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No... more like this:

    onMouseOver="this.style.color='hovertxtcolor;this.style.backgroundColor='hoverbgcolor';"

    where the hover colors are defined in a linked css file.

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Uh, you are trying to treat CSS rules like javascript variables, or something. Why not just switch classes?

    input.over {
    color: white;
    background-color: blue;
    /* Or whatever */
    }

    onMouseOver="this.className = 'over'" onMouseOut="this.className=''"
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Pacific NW
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Beautiful Beetle! The more I learn, the more I get excited about it and wish I could spend all day playing around... alas, bills must be paid and all that blah blah blah.

    Thanks again!


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
  •