Results 1 to 5 of 5

Thread: xhtml: creating a link out of a <td> [resolved]

  1. #1

    Thread Starter
    New Member llamabird's Avatar
    Join Date
    Apr 2004
    Location
    The land down under
    Posts
    3

    Post xhtml: creating a link out of a <td> [resolved]

    Im trying to create links from <td> tags that i have in my site. I realise that i can put the whole <td> in a <a> tag, or put a <div> within a <a> within a <td>, but dreamweaver picks both of these up as xhtml 1.0 incompat's as i'm trying to make the site comply with it, i dont know what to do.... thanks in advance.
    Last edited by llamabird; Jun 1st, 2004 at 03:02 AM.

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    This is perfectly valid XHTML 1.0 strict:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    
    <body>
    <table width="75%" border="1">
      <tr>
        <td>text</td>
        <td>text</td>
        <td>text</td>
      </tr>
      <tr>
        <td>sid was here</td>
        <td><a href="pag2.html">a link</a></td>
        <td>more text</td>
      </tr>
      <tr>
        <td>moo</td>
        <td>wee</td>
        <td>even more</td>
      </tr>
    </table>
    </body>
    </html>
    according to the W3C validator

  3. #3
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    I think you were trying to put a td tag within an a tag when it should be an a tag within a td tag.

  4. #4

    Thread Starter
    New Member llamabird's Avatar
    Join Date
    Apr 2004
    Location
    The land down under
    Posts
    3
    That's how i'v got it at the moment, but it means that you have to click on the text in the <td> to follow the link, i want to make it so that when you click anywhere in the <td> it will go to the href i specify. I thought this might be achievable with a onmousedown but i don't know the js to link to a new page.

  5. #5
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Code:
    <script type="text/javascript">
    function goto_URL(URL) {
    location.href=URL
    }
    </script>
    <td onmousedown="goto_URL('pag2.html')">

    I haven't tested that but I'm pretty sure it is XHTML compliant.

Posting Permissions

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



Click Here to Expand Forum to Full Width