SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Addict SniperUK's Avatar
    Join Date
    Jul 2000
    Location
    UK
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok I see alot of sites where when you go over a table it changes colour. I can get the code but i just want a neater version of the code! so can some one plz post it here!

    Thanks Alot

  2. #2
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Neater than what? Needs to be in comparison to something...

    DynamicDrive.com has what you're looking for...
    http://www.dynamicdrive.com/dynamici...lighttable.htm



  3. #3
    mouse monkey
    Join Date
    Dec 1999
    Location
    UK
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    You can also do the same thing by using CSS which uses a lot less code. If you put this in the <head> of the document:

    Code:
    <STYLE type=text/css>
    A.link:hover { BACKGROUND-COLOR: #******; TEXT-DECORATION: none; }
    </style>
    Change ****** with the colour code of the colour you want the table to change too. And then all you need to do then is put a link in a cell with this code:

    Code:
    <a href="link/to/page.html class="link">Link Text</a>
    Hope that works but please note the above code is not compatible with Netscape 4.7 but I am not sure whether or not it will be compatible with NS 6

    [Edited by Fletch on 10-12-2000 at 02:45 PM]

  4. #4
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Won't that hightlight just the background behind the text, and not the whole table cell?

  5. #5
    SitePoint Addict SniperUK's Avatar
    Join Date
    Jul 2000
    Location
    UK
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fletch I think that code *only* changes the backround of the text! Thanks TWTCommish I will have a look, did'nt think they would have it.

  6. #6
    mouse monkey
    Join Date
    Dec 1999
    Location
    UK
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yeah sorry I was being dumn there, I forgot about that only highlighting behind the text. I'm sure I did it with CSS a while ago but I must be confussed.

    Sorry

  7. #7
    Gong!
    Join Date
    May 2000
    Location
    Helsinki, Finland
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You must mean the thing like in for example http://www.anandtech.com - or similar anyway.

    It's rather easy. Here's a small example, which should clear things up a bit:

    Code:
    <table width="450" cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td onmouseover="this.style.background='#FF0000'" onmouseout="this.style.background='#EFEFEF'" align="center" bgcolor="#EFEFEF" width="150">
    <a href="">Link</a>
    </td>
    <td onmouseover="this.style.background='#FF0000'" onmouseout="this.style.background='#FFFFFF'" align="center" bgcolor="#FFFFFF" width="150">
    <a href="">Link</a>
    </td>
    <td onmouseover="this.style.background='#FF0000'" onmouseout="this.style.background='#EFEFEF'" align="center" bgcolor="#EFEFEF" width="150">
    <a href="">Link</a>
    </td>
    </tr>
    </table>
    Notice the two Javascript events, onmouseover and onmouseout.

    Just add it to the table cells and it should work.

  8. #8
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, great job hmahonen! Is it okay if someone like, uh, say, myself uses that on a site?

  9. #9
    SitePoint Addict SniperUK's Avatar
    Join Date
    Jul 2000
    Location
    UK
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey thanks thats a great code!!!
    Does it work with NS or is it just IE.
    Thanks Again

  10. #10
    Gong!
    Join Date
    May 2000
    Location
    Helsinki, Finland
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    TWTCommish: Actually even if I just wrote it out of my head, I've seen it somewhere before, but feel free to use it as much as you dare to

    Luqman: No, it doesn't work in Netscape, because it uses CSS to define the color for the background.




  11. #11
    SitePoint Addict SniperUK's Avatar
    Join Date
    Jul 2000
    Location
    UK
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Again
    This is a better code than the dynamic drive. I'll let you know if i have prob's.

    100 Posts At This Point For Me!

  12. #12
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Lugman,

    Actually, if I remember right, there is a NN ver 4 solution. If you go to news:comp.lang.javascript and look for a Martin Honnen, he has it.

    Vinny

  13. #13
    SitePoint Addict SniperUK's Avatar
    Join Date
    Jul 2000
    Location
    UK
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Vin i'll have a look, the above code does work on Netscape 6 P2.

  14. #14
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Lugman,

    Hope you find him. I haven't been there in a while, so I'm not sure he's still posting. You might also try dejavu.com
    I'm not surprised it works for NN6.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  15. #15
    SitePoint Addict SniperUK's Avatar
    Join Date
    Jul 2000
    Location
    UK
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks


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
  •