Stupid HTML question

Sharky Forums


Results 1 to 9 of 9

Thread: Stupid HTML question

  1. #1
    Tiger Shark
    Join Date
    Oct 2000
    Posts
    624

    Stupid HTML question

    I can't beleive I can't figure this one out. The answer must be obvious.

    I have a text link in a cell of a table. I want the link to work when I click anywhere in the cell of the table and not just when I click on the text link. How should I do this?

    Most references recommend against putting too many tags inside the link tags. I can put the entire cell inside these tags, but then it doesn't change my mouse cursor(to the hand icon) when mousing over the link. This can't be the right way.

    Thanks in advance for the help.

  2. #2
    Reef Shark
    Join Date
    Feb 2001
    Posts
    261
    this is just what i think...

    i dont think HTML can handle what u want. I think u need to use some javascript to make that work.

  3. #3
    Reef Shark mefisto3's Avatar
    Join Date
    Jul 2001
    Location
    Melbourne, Vic, Australia
    Posts
    429
    First of all, i dont think the <td> tags are allowed inside the <a> tags. Some browsers might not handle it corrctly. one solution i can think of to your problem is to use images rather than text.

    Just create a simple gif file with the text that u want and the right background colour and the same size as your table cell and put this in the cell. Then put the <a> tags around the image tags. that way wherever u click in the cell the link will work (as long they cell and the image are the same size).

  4. #4
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077
    Yoshi speaks the truth - JavaScript makes this incredibly easy. Here is a simple example of a table cell which acts and feels like a fully hyperlinked entity:

    Code:
    <td 	bgColor="#0E1448" 
    	onMouseOver="this.bgColor='#4851AA'" 
    	onMouseOut="this.bgColor='#0E1448'" 
    	onClick="document.location.href='mylink.htm'" 
    	style="cursor:hand;">
    
    	This is a test link...
    </td>

  5. #5
    Expensive Sushi
    Join Date
    Feb 2001
    Location
    Philippines
    Posts
    43

    Lightbulb uhuh!

    I can't imagine how possible is that code.
    Well, I think you are < STYLE > tag from there?:rolleyes:
    Ahihihi!
    Leslung

  6. #6
    Reef Shark Nephalim's Avatar
    Join Date
    Nov 2000
    Location
    Michigan
    Posts
    463
    Grizzly's code is perfect except that bgcolor is a deprecated property/attribute and should technically be added the style attribute like so:
    Code:
    style="background:#0E1448;cursor:hand"
    Don't let me sound too picky... just thought I'd add that little tidbit. Most browsers are backwards compatible and bgcolor will still work.

  7. #7
    Tiger Shark
    Join Date
    Oct 2000
    Posts
    624
    Thanks Grizzly and Nephalim. I just spent the night studying a book on CSS's and javascript. Pretty cool stuff. I'm working on making a IE and NN friendly popout menu system. Looks like it will be a snap now.

  8. #8
    Reef Shark
    Join Date
    Feb 2001
    Posts
    261
    thanks, i just had a project that could use that.

  9. #9
    Goldfish daftness101's Avatar
    Join Date
    Jun 2002
    Location
    Fresno, CA, US, NW Hemisphere, Earth, Milky Way
    Posts
    52
    um, I thought it was style="background-color: #0e1488; cursor: pointer"? Don't mean to sound picky or anything.

    -Daft

Posting Permissions

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