SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Mouseover question

    Is there any way to have the background color change in a cell only when the mouse is over the link?

    This is what I have so far:

    <td class=topnav2 onClick="location.href='AboutAD/overview.htm'" onMouseOut="this.style.backgroundColor='#9966FF'"onMouseOver="this.style.backgroundColor='#660099'" bgcolor="#9966FF" width="107" height="45"valign="middle">
    <a class="topnav2" href="AboutAD/overview.htm">About Alzheimer's</a>

    -----

    Currently you rollover the cell it changes color, I just want this effect when you roll over the text.

    thanks in advance

    xnihilo

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should work in ie5+ and netscape 6

    <td class=topnav2 onClick="location.href='AboutAD/overview.htm'" bgcolor="#9966FF" width="107" height="45"valign="middle">
    <a class="topnav2" href="AboutAD/overview.htm" onMouseOut="this.parentNode.style.backgroundColor='#9966FF'"onMouseOver="this.parentNode.style.backgroundColor='#660099'" >About Alzheimer's</a>

  3. #3
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    thanks and another question...

    Thanks! I really appreciate it.


    As far as IE 4 is concerned I keep on getting an error that states that the parentnode is not an object.

    What would I have to do in order not to get this error.


    thanks


    xnihilo

  4. #4
    .NET inside archigamer's Avatar
    Join Date
    Jan 2002
    Location
    Strongsville OH
    Posts
    1,534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there is really not much you can do. ie4 does not support DOM which shoop is using.
    Web Finesse Studios
    Professional, business oriented web hosting and development.

  5. #5
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    oh crud...

    Well thanks for that piece of info.

    Hmm...so nothing I can do? no work arounds? any suggestions?

    nothing I can do to fool ie 4?

    thanks again


    xnihilo

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try your original mouseover/mouseout code but just move it up into the td tags.

  7. #7
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool thanks

    Just one more question (as you can tell I'm pretty new at this) As was stated IE 4 Does not support DOM but I would like IE 4 to at least ignore it. I'm not quite sure how to do that. Any pointers? tips?

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, ignore my last post. I'm not sure what I was thinking about when I wrote that.

    What you probably need to do is

    instead of this -
    onMouseOut="this.parentNode.style.backgroundColor='#9966FF'"
    onMouseOver="this.style.backgroundColor='#660099'"

    do this -
    onMouseOut="styleOut()"
    onMouseOver="styleOver()"

    Put an Id in the cell you want to change color (id="change")
    Then write the functions to work with multiple browsers. e.g.

    function styleOut(){
    if (document.getElementById)
    document.getElementById('change').style.backgroundColor='#9966FF';

    if (document.all)
    document.all['change'].style.backgroundColor='#9966FF';

    }

    Hope this is of some help.

    Shoop

  9. #9
    SitePoint Wizard Goof's Avatar
    Join Date
    Feb 2001
    Location
    Pittsburgh, PA
    Posts
    1,154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This isn't exactly what you asked for, but I'm pretty sure that I don't get an error in IE4 (I can't remember for sure, but you can test it), and I do it by putting the code in the td tag, like this:
    Code:
    <td onMouseOver="this.style.backgroundColor = 'red'; this.style.cursor = 'hand';" onMouseOut="this.style.backgroundColor = 'blue';" onClick="location.HREF = 'whatever.html';"><a herf="whatever.html">Whatever</a></td>
    Note that this will change the color of the cell when you put the mouse of the cell (not the link), and you must put the target for the link in both the anchor tag, and in the onClick portion of the td tag.

    Hope that helps,
    Goof
    Nathan Rutman
    A slightly offbeat creative.

  10. #10
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank you! thank you!

    Shoop and others,

    I really appreciate all your help. This worked!

    Thank you all for your comments and help.


    You guys rock!


    thanks

    xnihilo


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
  •