tags:

views:

57

answers:

3

In a table structure, I add a hyperlink like this:

<table>
    <tr>
        <a href='http://www.google.com'&gt;link&lt;/a&gt;
    </tr>
</table>

But it display as plain text on the browser(IE or firfox) like this:

<a href='www.google.com'>link</a>

not a link point.

who can tell me the reason? thankx.

+2  A: 

Try it like this:

<table>    
    <tr>        
        <td>
            <a href="http://www.google.com"&gt;link&lt;/a&gt;
        </td>
    </tr>
</table>
treaschf
Don't forget to prepend "http://" to the URL, else it'd be relative to the current site.
K Prime
You are right, I missed that. :)
treaschf
+2  A: 

Two items. As treaschf noted you need to use double quotes, and for any link leaving your site you need to preface it with http://

<table>    
    <tr>        
        <td>
            <a href="http://www.google.com"&gt;link&lt;/a&gt;
        </td>
    </tr>
</table>
Jason Aller
I don't think that there will be any difference in setting the attribute values in double quotes rather than giving it in single quotes.
rahul
Unlike treaschf's reply, this one fixes all the problems in the HTML snippet.
Conrad Meyer
@adamantium: Perhaps, but the http:// is needed.
Conrad Meyer
Technically, single quotes are fine according to both HTML 4 and XHTML. See http://www.w3.org/TR/REC-xml/#NT-AttValue That said, I trust web browsers to follow standards about as much as I trust politicians to follow their campaign promises. Use double quotes.
Schwern
But even if he doesn't give the http:// the link should work but won't point to the correct location.
rahul
A: 

You are missing the TD element so the HTML is invalid. Pass your HTML through the HTML Validator.

Rob Kent