What's wrong with this code?

Discussion in 'HTML' started by Jeff Castaldo, Mar 18, 2008.

  1. I'm going crazy over this "simple" code. Why will the top code work exctly
    as I want it to, and the lower code will not work at all, with or without
    the _blank?

    This works:
    <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    src="images/product_images/4870_t.jpg" /></a>

    This doesn't:
    <td><a href="images/product_images/4870_lg.jpg" /><img
    src="images/product_images/4870_t.jpg" /></a></td>

    The ONLY dfference between the code is that in one I am trying to make the
    link clickable inside a table cell. Is there something wrong with that?

    Thank you for helping.

    Jeff
     
    Jeff Castaldo, Mar 18, 2008
    #1
    1. Advertising

  2. Jeff Castaldo

    Neredbojias Guest

    On 17 Mar 2008, Jeff Castaldo wrote:

    > I'm going crazy over this "simple" code. Why will the top code work
    > exctly as I want it to, and the lower code will not work at all, with
    > or without the _blank?
    >
    > This works:
    > <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    > src="images/product_images/4870_t.jpg" /></a>
    >
    > This doesn't:
    > <td><a href="images/product_images/4870_lg.jpg" /><img
    > src="images/product_images/4870_t.jpg" /></a></td>
    >
    > The ONLY dfference between the code is that in one I am trying to make
    > the link clickable inside a table cell. Is there something wrong with
    > that?


    It might have to do with the (incorrect) trailing slash on the <a> tag.

    --
    Neredbojias
    http://www.neredbojias.com/
    Great sights and sounds
     
    Neredbojias, Mar 18, 2008
    #2
    1. Advertising

  3. Jeff Castaldo

    dorayme Guest

    In article <ReEDj.4450$i54.93@trnddc05>,
    "Jeff Castaldo" <> wrote:

    > I'm going crazy over this "simple" code. Why will the top code work exctly
    > as I want it to, and the lower code will not work at all, with or without
    > the _blank?
    >
    > This works:
    > <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    > src="images/product_images/4870_t.jpg" /></a>
    >
    > This doesn't:
    > <td><a href="images/product_images/4870_lg.jpg" /><img
    > src="images/product_images/4870_t.jpg" /></a></td>
    >
    > The ONLY dfference between the code is that in one I am trying to make the
    > link clickable inside a table cell. Is there something wrong with that?
    >


    That is not the only difference I see.

    If you make them the same and go:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <p><a href="http://www.guardian.co.uk/sudoku"><img
    src="pics/crimson.png" alt=""></a></p>
    <table>
    <tr>
    <td><a href="http://www.guardian.co.uk/sudoku"><img
    src="pics/crimson.png" alt=""></a></td>
    </tr>
    </table>
    </body>
    </html>

    This should make the link clickable in the cell as with the one
    not in a table cell.

    Ditto:

    if you add target="_blank" to them both. (Validation in this case
    is another matter)

    --
    dorayme
     
    dorayme, Mar 18, 2008
    #3
  4. Actually, I've found that BOTH codes work perfectly in Firefox and Opera, so
    it is definetly an IE6 problem. I do not have IE7 installed on this
    machine, so I cannot test with it.

    Now, does anyone have a coding "fix"?

    Thanks very much.

    Jeff


    "dorayme" <> wrote in message
    news:...
    > In article <ReEDj.4450$i54.93@trnddc05>,
    > "Jeff Castaldo" <> wrote:
    >
    >> I'm going crazy over this "simple" code. Why will the top code work
    >> exctly
    >> as I want it to, and the lower code will not work at all, with or without
    >> the _blank?
    >>
    >> This works:
    >> <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    >> src="images/product_images/4870_t.jpg" /></a>
    >>
    >> This doesn't:
    >> <td><a href="images/product_images/4870_lg.jpg" /><img
    >> src="images/product_images/4870_t.jpg" /></a></td>
    >>
    >> The ONLY dfference between the code is that in one I am trying to make
    >> the
    >> link clickable inside a table cell. Is there something wrong with that?
    >>

    >
    > That is not the only difference I see.
    >
    > If you make them the same and go:
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/TR/html4/strict.dtd">
    > <html>
    > <head>
    > <title></title>
    > </head>
    > <body>
    > <p><a href="http://www.guardian.co.uk/sudoku"><img
    > src="pics/crimson.png" alt=""></a></p>
    > <table>
    > <tr>
    > <td><a href="http://www.guardian.co.uk/sudoku"><img
    > src="pics/crimson.png" alt=""></a></td>
    > </tr>
    > </table>
    > </body>
    > </html>
    >
    > This should make the link clickable in the cell as with the one
    > not in a table cell.
    >
    > Ditto:
    >
    > if you add target="_blank" to them both. (Validation in this case
    > is another matter)
    >
    > --
    > dorayme
    >
     
    Jeff Castaldo, Mar 18, 2008
    #4
  5. Neredbojias wrote:

    > On 17 Mar 2008, Jeff Castaldo wrote:
    >
    >> I'm going crazy over this "simple" code. Why will the top code work
    >> exctly as I want it to, and the lower code will not work at all, with or
    >> without the _blank?
    >>
    >> This works:
    >> <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    >> src="images/product_images/4870_t.jpg" /></a>
    >>
    >> This doesn't:
    >> <td><a href="images/product_images/4870_lg.jpg" /><img
    >> src="images/product_images/4870_t.jpg" /></a></td>
    >>
    >> The ONLY dfference between the code is that in one I am trying to make
    >> the link clickable inside a table cell. Is there something wrong with
    >> that?

    >
    > It might have to do with the (incorrect) trailing slash on the <a> tag.


    But that's consistent...

    --
    Blinky
    Killing all posts from Google Groups
    The Usenet Improvement Project: http://improve-usenet.org
    Blinky: http://blinkynet.net
     
    Blinky the Shark, Mar 18, 2008
    #5
  6. Jeff Castaldo wrote:

    >>> This works:
    >>> <a href="images/product_images/4870_lg.jpg" target="_blank" /><img

    ^

    >>> src="images/product_images/4870_t.jpg" /></a>
    >>>
    >>> This doesn't:
    >>> <td><a href="images/product_images/4870_lg.jpg" /><img

    ^

    >>> src="images/product_images/4870_t.jpg" /></a></td>


    Both errors "closes" the A element twice...



    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Mar 18, 2008
    #6
  7. Jonathan N. Little wrote:

    > Jeff Castaldo wrote:
    >
    >>>> This works:
    >>>> <a href="images/product_images/4870_lg.jpg" target="_blank" /><img

    > ^
    >
    >>>> src="images/product_images/4870_t.jpg" /></a>
    >>>>
    >>>> This doesn't:
    >>>> <td><a href="images/product_images/4870_lg.jpg" /><img

    > ^
    >
    >>>> src="images/product_images/4870_t.jpg" /></a></td>

    >
    > Both errors "closes" the A element twice...


    So why - as OP asked - does one work and one not work?

    --
    Blinky
    Killing all posts from Google Groups
    The Usenet Improvement Project: http://improve-usenet.org
    Blinky: http://blinkynet.net
     
    Blinky the Shark, Mar 18, 2008
    #7
  8. Jeff Castaldo

    Neredbojias Guest

    On 17 Mar 2008, Blinky the Shark wrote:

    > Neredbojias wrote:
    >
    >> On 17 Mar 2008, Jeff Castaldo wrote:
    >>
    >>> I'm going crazy over this "simple" code. Why will the top code work
    >>> exctly as I want it to, and the lower code will not work at all,
    >>> with or without the _blank?
    >>>
    >>> This works:
    >>> <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    >>> src="images/product_images/4870_t.jpg" /></a>
    >>>
    >>> This doesn't:
    >>> <td><a href="images/product_images/4870_lg.jpg" /><img
    >>> src="images/product_images/4870_t.jpg" /></a></td>
    >>>
    >>> The ONLY dfference between the code is that in one I am trying to
    >>> make the link clickable inside a table cell. Is there something
    >>> wrong with that?

    >>
    >> It might have to do with the (incorrect) trailing slash on the <a>
    >> tag.

    >
    > But that's consistent...


    Well, without a url or at least a real example of full, actual markup,
    we're all just guessing.

    --
    Neredbojias
    http://www.neredbojias.com/
    Great sights and sounds
     
    Neredbojias, Mar 18, 2008
    #8
  9. Blinky the Shark wrote:

    > Jonathan N. Little wrote:
    >> Jeff Castaldo wrote:
    >>>>> This works:
    >>>>> <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    >>>>> src="images/product_images/4870_t.jpg" /></a>
    >>>>>
    >>>>> This doesn't:
    >>>>> <td><a href="images/product_images/4870_lg.jpg" /><img
    >>>>> src="images/product_images/4870_t.jpg" /></a></td>

    >>
    >> Both errors "closes" the A element twice...

    >
    > So why - as OP asked - does one work and one not work?


    I copied the OP's code into a local page, and it works, for both
    iterations. In several browsers, including IE6.

    I did add <table><tr> around the second, and substituted my own image
    for both, as I do not have the OP's images, of course.

    --
    -bts
    -Friends don't let friends drive Vista
     
    Beauregard T. Shagnasty, Mar 18, 2008
    #9
  10. Jeff Castaldo

    rf Guest

    "Beauregard T. Shagnasty" <> wrote in message
    news:%KNDj.39197$...
    > Blinky the Shark wrote:
    >
    >> Jonathan N. Little wrote:
    >>> Jeff Castaldo wrote:
    >>>>>> This works:
    >>>>>> <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    >>>>>> src="images/product_images/4870_t.jpg" /></a>
    >>>>>>
    >>>>>> This doesn't:
    >>>>>> <td><a href="images/product_images/4870_lg.jpg" /><img
    >>>>>> src="images/product_images/4870_t.jpg" /></a></td>
    >>>
    >>> Both errors "closes" the A element twice...

    >>
    >> So why - as OP asked - does one work and one not work?

    >
    > I copied the OP's code into a local page, and it works, for both
    > iterations. In several browsers, including IE6.
    >
    > I did add <table><tr> around the second, and substituted my own image
    > for both, as I do not have the OP's images, of course.


    All the more reason for the OP to supply a URL.

    No URL - guesswork. URL - point out the error immediately, rather than
    beating around the bush for half a day, as we all are.

    OP: Big Bloody Hint!

    The only saving grace is that the OP is not a google grouper.

    --
    Richard.
     
    rf, Mar 18, 2008
    #10
  11. Scripsit Jeff Castaldo:

    > I'm going crazy over this "simple" code.


    Then replace it with simple code.

    > Why will the top code work
    > exctly as I want it to, and the lower code will not work at all, with
    > or without the _blank?


    By accident. By browser errors. Browsers don't process your markup by
    HTML rules _or_ by XHTML specifications but by tagsoup rules. But why
    would you care? Just use reasonable markup, and let browsers do
    unreasonable things with unreasonable markup.

    > This works:
    > <a href="images/product_images/4870_lg.jpg" target="_blank" /><img
    > src="images/product_images/4870_t.jpg" /></a>


    Consider it a bug, or the result of a mixed collection of bugs.

    Use correct markup:

    <a href="images/product_images/4870_lg.jpg"><img
    src="images/product_images/4870_t.jpg" alt="Photo of product 4870"></a>

    (The target attribute was omitted here because it "works" so badly when
    it works. By omitting it, you give users a simple option of deciding
    whether they open the resource in the same window, possibly in a new
    pane, or in a new window.)

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 18, 2008
    #11
  12. Jeff Castaldo

    dorayme Guest

    In article <%7VDj.312471$>,
    "Jukka K. Korpela" <> wrote:

    > Scripsit Jeff Castaldo:
    >
    > > I'm going crazy over this "simple" code.

    >
    > Then replace it with simple code.


    As I said in the first place. And gave example. Thanks JK, I
    hope, as we discussed over coffee yesterday, this galvanises the
    OP. My examples and thoughts and your authority. What a
    combination. Like a left jab followed by a big swing right. I
    knew our double act would just go on and on.

    --
    dorayme
     
    dorayme, Mar 18, 2008
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. walala
    Replies:
    3
    Views:
    2,194
    Ralf Hildebrandt
    Sep 10, 2003
  2. willem oosthuizen

    What is wrong with the following code?

    willem oosthuizen, Oct 10, 2003, in forum: VHDL
    Replies:
    9
    Views:
    1,281
  3. Matthew
    Replies:
    7
    Views:
    676
    Priscilla Walmsley
    Jan 7, 2005
  4. David. E. Goble
    Replies:
    9
    Views:
    480
    David. E. Goble
    Feb 2, 2005
  5. kiran
    Replies:
    12
    Views:
    1,129
    Scott Sauyet
    Dec 7, 2011
Loading...

Share This Page