Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Dec 2005
    Location
    Canvey Island, Essex, UK
    Posts
    67
    Member #
    12033
    Well I need to ask a few questions,

    I would like to be able to make a cell in a table highlight when it is hovered on.

    I looked at an old post:
    View Topic

    And i got it to highlight, but i would also like to get the whole cell to act as a link.

    How would i be able to do it?

    Thanks
    Matthew Stocker
    (X)HTML, CSS, PHP & JavaScript Developer

  2.  

  3. #2
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    The simplest method would be to use javascript's onmouseover event to change the cell's class, and then onmouseout to return it.

    Do you need more help? I can give you more code, but it depends if you're already using a JS library.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  4. #3
    Member
    Join Date
    Dec 2005
    Location
    Canvey Island, Essex, UK
    Posts
    67
    Member #
    12033
    Well im not using any libraries at all really.

    Just this code:
    <td onMouseOver="this.bgColor='#333333';" onMouseOut="this.bgColor='#000000';" bgColor="#000000">About Us</td>
    How would i get the whole cell to act as a link when the cell is clicked?

    Any help appreciated
    Matthew Stocker
    (X)HTML, CSS, PHP & JavaScript Developer

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Well if you do not mind using JavaScript to achieve this, simply give the td a onclick event.

    Such as..

    HTML Code:
    <td onclick="javascript: window.location='file.html';">lorem</td>
    Untested code.

  6. #5
    Member
    Join Date
    Dec 2005
    Location
    Canvey Island, Essex, UK
    Posts
    67
    Member #
    12033
    It works, thanks I have now sorted it out.

    Thanks again everyone!
    Matthew Stocker
    (X)HTML, CSS, PHP & JavaScript Developer


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:59 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com