1

Chrome 和 Firefox 中没有超链接(如果我单击,Firefox 链接将打开,但指针不显示可单击)。我正在尝试这个:

<a href="http://www.teamrustic.com/" target="_blank"> 
    <embed class="ads" 
           style="margin:0px;border:0px;" 
           src="swf/flash_banner.swf"
           width="315" height="100" wmode="opaque">
    </embed>
</a>​

尝试使用 CSS.ads{cursor : pointer;}

4

1 回答 1

2

问题是在某些浏览器中,flash 捕获了点击事件,而不是通过 DOM 过滤它。对此没有具体的解决方法。

我知道有两种解决方法:

  1. 将代码添加到处理点击并打开相应 URL 的 swf 文件中
  2. 在 Flash 顶部放置一个“垫片”不可见链接,该链接可以适当地捕获点击和链接 - 请注意,您的 Flash 文件中只能有其中的一个,因此如果您需要 Flash 文件中的两个链接,它将不起作用。

#2 的例子:

<div id="flashContainer">
    <a id="shim" href="mylink.aspx">&nbsp;</a>
    <div id="flash">
        <embed class="ads" src="swf/flash_banner.swf" width="315" height="100" wmode="opaque"></embed>
    </div>
</div>
#flashContainer {
    position: relative;
}
#flash { 
    z-index: 5;
}
#shim {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 315px;
    height: 100px;
    z-index: 10;
}

更新

#2 使用 div 的示例,使用 jQuery 连接点击事件:

<div id="flashContainer">
    <div id="shim"></div>
    <div id="flash">
        <embed class="ads" src="swf/flash_banner.swf" width="315" height="100" wmode="opaque"></embed>
    </div>
</div>
#flashContainer {
    position: relative;
}
#flash { 
    z-index: 5;
}
#shim {
    position: absolute;
    top: 0;
    left: 0;
    width: 315px;
    height: 100px;
    cursor: hand; cursor: pointer;
    z-index: 10;
}
$("#shim").click(function() {
    window.location.assign("mylink.aspx");
});
于 2012-04-11T13:48:45.087 回答