map area:onfocus=blur()在IE中有效,但现在为Firefox添加了一个大纲



我有一个图像映射:

<map>
  <area ..>
  <area ..>
</map>

IE中出现了一个大纲,所以我将代码修改为:

<area onfocus="blur();"

这从IE中删除了大纲,但现在我在Firefox(版本9.0.1)中点击该区域时有了大纲…

我也试过:

map > area,
map > area:active,
map > area:focus {outline: none; border:0; }
  • 正在使用此帖子中的信息

如有任何建议,我们将不胜感激。

尝试将其添加到您的CSS:中

area:active, area:focus {
    outline: none;
}

问题已解决:

onclick="blur()" onfocus="navigator.appName == 'Microsoft Internet Explorer' ? blur() : null"

这样一个奇怪的问题。我尝试了Sally Oldfield的解决方案,但发现Chrome与IE存在相同的问题——它需要blur()调用。

这就是我在Firefox、Chrome和IE中找到的解决方案:

<area onfocus="navigator.userAgent.indexOf('Firefox') != -1 ? null : blur()" ... />
<area tabindex="-1" [...] />

我原以为我使用blur()解决方案的jQuery版本解决了这个问题,该解决方案适用于Safari,但后来FF有了一个虚线轮廓。将一个tabindex="-1"添加到为两者求解的每个!

最新更新