views:

3829

answers:

3

Edit: closing anchor fixed - This issue exists when testing on the following browsers

  • Google Chrome
  • Firefox 3.5
  • Safari

  • Works with no problems on IE 8
    Hey guys,
    I'v a really weired problem here! In short, take a look at the following html:

    <a href="login_page.html" class="img">
    <span class="img_holder">
     <img src="images/columnists/mike_zeisberger248.jpg" onerror="this.src='default.jpg'"/>
    </span>
    <span class="btn">track him</span></a>
    

    Here's the img_holder css class

    .img_holder{
    border: 1px solid #c8c8c8;
    display:block;
    background:#fff; 
    height: 100px
    

    }

    and the img class

    .img{
    _margin:0 12px 12px 0;
    

    }

    Now, the problem is that, clicking the image nested inside the anchor tag doesn't take you to it's href link (thought, the href link shows in the status bar when hovering over the image, and opens perfectly fine when opening in new tab).

    any ideas!?

    +5  A: 

    Well, there area few obvious problems that spring out; one is the / before your onerror, and the second is that the <a> in question doesn't seem to be closed.

    Apart from that, there doesn't seem to be any obvious reasons why it wouldn't work; perhaps a more complete post of source code is in order?

    Williham Totland
    Closed it, it's not the problem anyways. just mistyped !
    Galilyou
    A: 

    what is with the trailing slash after the img src attribute? also you don't appear to be wrapping the html snippet with the anchor tag.

    Harry
    missed your answers by one minute!
    Harry
    Plz check again, I edited! thx
    Galilyou
    http://en.wikipedia.org/wiki/XHTML#Common_errors
    Typeoneerror
    +5  A: 
    David Dorward
    This problem exists with Firefox and Chrome too.
    Galilyou
    well, actually it's working on IE 8 with no problems.
    Galilyou
    "Working on IE with no problems" isn't exactly the best sign that it's valid code. ;)
    James S
    @jamesshannon didn't mean it's a valid code! IE means Valid code! Come on. It was a reply to David's inital answer where he stated that IE has issues with anchors that are display: inline
    Galilyou