在Firefox锚链接的作品,但里面没有在Internet Explorer中的按钮? [英] Button inside of anchor link works in Firefox but not in Internet Explorer?

查看:160
本文介绍了在Firefox锚链接的作品,但里面没有在Internet Explorer中的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其他的一切在我的网站似乎是除了我所有的链接浏览器兼容。他们出现在页面上,但他们不工作。我的code的链接如下 -

 < TD BGCOLOR =#FFFFFFHEIGHT =370VALIGN =顶WIDTH =165>
    &所述p为H.;
        &所述; A HREF =sc3.html>
            <按钮样式=WIDTH:120;高度:25>超级化学#3',/按钮>
        &所述; / A>
        &所述; A HREF =91hollywood.html>
            <按钮样式=WIDTH:120;高度:25> 91好莱坞LT; /按钮>
        &所述; / A>
        &所述; A HREF =sbubba.html>
            <按钮样式=WIDTH:120;高度:25>超级布巴< /按钮>
        &所述; / A>
        &所述; A HREF =afgoohash.html>
            <按钮样式=WIDTH:120;高度:25> Afgoo哈希< /按钮>
        &所述; / A>
        &所述; A HREF =superjack.html>
            <按钮样式=WIDTH:120;高度:25>超级杰克< /按钮>
        &所述; / A>
        &所述; A HREF =sog.html>
            <按钮样式=WIDTH:120;高度:25>糖OG< /按钮>
        &所述; / A>
        &所述; A HREF =91pk91.html>
            <按钮样式=WIDTH:120;高度:25> 91点¯xPK< /按钮>
        &所述; / A>
        &所述; A HREF =jedi1.html>
            <按钮样式=WIDTH:120;高度:25>&绝地LT; /按钮>
        &所述; / A>
    &所述; / P>
    &所述p为H.;&放大器; NBSP;&下; / P>
    &所述; A HREF =htt​​p://indynile99.blogspot.com>
        <按钮样式=WIDTH:120;高度:25>博客< /按钮>
    &所述; / A>
    &所述p为H.;&放大器; NBSP;&下; / P>
< / TD>


解决方案

您不能有一个<按钮> &LT内部; A> 元素。


  

    

交互式元件按钮不能出现由于一个元件的后代。来源:<一个href=\"http://www.w3.org/TR/html-markup/button.button.html#button.button\">http://www.w3.org/TR/html-markup/button.button.html#button.button


  

要得到你所要寻找的效果,可以沟&LT; A&GT; 标签,并添加一个简单的事件处理程序,以每个导航浏览器按钮所需的位置,例如:

 &LT;输入类型=按钮值=stackoverflow.com的onClick =JavaScript的:location.href ='http://stackoverflow.com'; /&GT;

请考虑的不可以这样做,但是,有一个原因,因为他们做定期环节的工作:


  • 用户可以一眼就能认出的联系,了解他们浏览其他页面

  • 搜索引擎可以识别它们为链接,并按照他们

  • 屏幕阅读器可以识别它们为链接和他们的用户适当地提醒

您也加入到启用JavaScript只是为了执行基本的导航完全没有必要要求;这是互联网的这样一个基本方面,我会考虑这样的依赖是不可接受的。

您可以风格你的链接,如果需要的话,使用背景图片和背景颜色,边框等手法,使他们的看看如按钮,但在幕后,他们应该是普通的链接。

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>&nbsp;</p>
    <a href="http://indynile99.blogspot.com">
        <button style="width:120;height:25">Blog</button>
    </a>
    <p>&nbsp;</p>
</td>

解决方案

You can't have a <button> inside an <a> element.

"The interactive element button must not appear as a descendant of the a element." Source: http://www.w3.org/TR/html-markup/button.button.html#button.button

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.com" onClick="javascript:location.href = 'http://stackoverflow.com';" />

Please consider not doing this, however; there's a reason regular links work as they do:

  • Users can instantly recognise links, and understand that they navigate to other pages
  • Search engines can identify them as links and follow them
  • Screen readers can identify them as links and advise their users appropriately

You also add a completely unnecessary requirement to have JavaScript enabled just to perform 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 colour, border and other techniques, so that they look like buttons, but under the covers, they should be ordinary links.

这篇关于在Firefox锚链接的作品,但里面没有在Internet Explorer中的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆