【问题标题】:<a href=" "> not working<a href=" "> 不工作
【发布时间】:2014-01-10 13:16:57
【问题描述】:

以下超链接不起作用,但当您单击在新选项卡中打开按钮时它起作用。

<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>

我尝试过使用 Chrome 和 Firefox。直播页面可见here

【问题讨论】:

标签: html browser anchor href


【解决方案1】:

就像@Benjamin Gruenbaum 所说,试试这个:

<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>

如果你打算链接这个div,我想参考这个帖子:“Make a div into a link

【讨论】:

    【解决方案2】:

    如果您禁用 JavaScript,则链接有效。在 ajaxtoolbar.js 你有以下代码:

    $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;
    
    });
    

    return false; 阻止链接触发。

    【讨论】:

    • 谢谢。你能告诉我,你是怎么找到的?
    • 我看到了工具栏类,并在源代码中查找了任何名为“工具栏”的脚本。由于链接在新窗口中有效,我猜这是一个 javascript 问题。
    猜你喜欢
    • 2017-12-24
    • 2016-07-01
    • 2021-09-27
    • 2018-01-14
    • 2018-03-28
    • 2015-10-14
    • 1970-01-01
    • 1970-01-01
    • 2011-12-06
    相关资源
    最近更新 更多