not working

2019-05-26 10:41发布

问题:

The following hyperlink does not work, though it works when you click open in new tab button.

<div class="span12 category-products" style="margin: 0 auto;">
<div class="toolbar">
    <div class="row big_with_description" style="position:relative;">                                                                   
        <a href="http://www.grewal.nl/reviveme/repair/mobile.html">
            <div class="span5 product hover">
                <img src="http://www.grewal.nl/reviveme/media/catalog/category/mobile2.jpg" class="category-thumbnail product-retina" width="499" height="268" alt="Mobile">    
            </div>
        </a>
    </div>
</div>

I have tried using Chrome and Firefox. The live page can be seen here.

回答1:

If you disable JavaScript the link works. In ajaxtoolbar.js you have the following code:

$jq('a','.toolbar').click(function(event) {
    link    =   $jq(this).attr('href');

    if((link.search("mode=")!=-1||link.search("dir=")!=-1||link.search("price=")!=-1||link.search("p=")!=-1)&&(toolbarsend==false)){
        event.preventDefault();
        ajaxtoolbar.onSend(link,'get');
    }

    return false;

});

The return false; prevents the link from triggering.



回答2:

Like @Benjamin Gruenbaum said, try this:

<div class="span12 category-products" style="margin: 0 auto;">
  <div class="toolbar">
    <div class="row big_with_description" style="position:relative;">
      <div class="span5 product hover">                                         
        <a href="http://www.grewal.nl/reviveme/repair/mobile.html">
         <img src="http://www.grewal.nl/reviveme/media/catalog/category/mobile2.jpg" class="category-thumbnail product-retina" width="499" height="268" alt="Mobile">
        </a>
      </div>
    </div>
  </div>
</div>

If it was your intention to link with this div, I would like to refer to this post: "Make a div into a link"