除了我的链接之外,我网站中的所有其他内容似乎都与所有浏览器兼容.它们出现在页面上,但不起作用.我的链接代码如下-
Everything else in my site seems to be compatible with all browsers except for my links. They appear on the page, but they do not work. My code for the links are as follows-
<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> </p> <a href="indynile99.blogspot"> <button style="width:120;height:25">Blog</button> </a> <p> </p> </td> 推荐答案您不能在 元素中包含 .作为 W3 的内容模型 元素状态的描述:
You can't have a <button> inside an <a> element. As W3's content model description for the <a> element states:
不得有交互式内容后代."
"there must be no interactive content descendant."
(a 被认为是 互动内容)
为了获得您想要的效果,您可以放弃 <a> 标签并向每个按钮添加一个简单的事件处理程序,以便将浏览器导航到所需的位置,例如
To get the effect you're looking for, you can ditch the <a> tags and add a simple event handler to each button which navigates the browser to the desired location, e.g.
<input type="button" value="stackoverflow" onClick="javascript:location.href = 'stackoverflow';" />但是请考虑不要这样做;常规链接可以正常工作是有原因的:
Please consider not doing this, however; there's a reason regular links work as they do:
- 用户可以立即识别链接并理解他们导航到其他页面
- 搜索引擎可以将它们识别为链接并关注它们
- 屏幕阅读器可以将它们识别为链接并适当地向用户提供建议
您还添加了一个完全不必要的要求,即启用 JavaScript 以执行基本导航;这是网络的一个基本方面,我认为这种依赖是不可接受的.
You also add a completely unnecessary requirement to have JavaScript enabled just to perform a basic navigation; this is such a fundamental aspect of the web that I would consider such a dependency as unacceptable.
如果需要,您可以使用背景图像或背景颜色、边框和其他技术来设置链接的样式,使它们看起来像按钮,但在幕后,它们应该是普通链接.
You can style your links, if desired, using a background image or background color, border and other techniques, so that they look like buttons, but under the covers, they should be ordinary links.
更多推荐
锚链接内的按钮在 Firefox 中有效,但在 Internet Explorer 中无效?
发布评论