gpt4 book ai didi

html - anchor 链接内的按钮在 Firefox 中有效,但在 Internet Explorer 中无效?

转载 作者:技术小花猫 更新时间:2023-10-29 11:30:59 25 4
gpt4 key购买 nike

除了我的链接外,我网站上的其他所有内容似乎都与所有浏览器兼容。它们出现在页面上,但不起作用。我的链接代码如下-

<td bgcolor="#ffffff" height="370" valign="top" width="165">
<p>
<a href="sc3.html">
<button style="width:120;height:25">Super Chem #3</button>
</a>
<a href="91hollywood.html">
<button style="width:120;height:25">91 Hollywood</button>
</a>
<a href="sbubba.html">
<button style="width:120;height:25">Super Bubba</button>
</a>
<a href="afgoohash.html">
<button style="width:120;height:25">Afgoo Hash</button>
</a>
<a href="superjack.html">
<button style="width:120;height:25">Super Jack</button>
</a>
<a href="sog.html">
<button style="width:120;height:25">Sugar OG</button>
</a>
<a href="91pk91.html">
<button style="width:120;height:25">91 x PK</button>
</a>
<a href="jedi1.html">
<button style="width:120;height:25">Jedi</button>
</a>
</p>
<p>&nbsp;</p>
<a href="http://indynile99.blogspot.com">
<button style="width:120;height:25">Blog</button>
</a>
<p>&nbsp;</p>
</td>

最佳答案

你不能有 <button><a> 里面元素。作为W3's content model description对于 <a>元素状态:

"there must be no interactive content descendant."

( <button> 被认为是 interactive content )

要获得您正在寻找的效果,您可以放弃 <a>标记并向每个按钮添加一个简单的事件处理程序,将浏览器导航到所需的位置,例如

<input type="button" value="stackoverflow.com" onClick="javascript:location.href = 'http://stackoverflow.com';" />

不过,请考虑不要这样做;常规链接能正常工作是有原因的:

  • 用户可以立即识别链接并了解他们导航到其他页面
  • 搜索引擎可以将它们识别为链接并跟踪它们
  • 屏幕阅读器可以将它们识别为链接并适本地建议用户

您还添加了一个完全不必要的要求,即启用 JavaScript 只是为了执行基本导航;这是网络的一个基本方面,我认为这种依赖是 Not Acceptable 。

如果需要,您可以设置链接的样式,使用背景图像或背景颜色、边框和其他技术,使它们看起来像按钮,但在幕后,它们应该是普通链接。

关于html - anchor 链接内的按钮在 Firefox 中有效,但在 Internet Explorer 中无效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/802839/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com