【问题标题】:Rendering of <h:commandbutton> in Firefox?在 Firefox 中渲染 <h:commandbutton>?
【发布时间】:2010-07-19 20:51:16
【问题描述】:

当我们将 disabled 属性设置为 true 时,在 Firefox 中该按钮看起来仍然是启用的,但在 IE 中它工作正常。是 Firefox 还是 JSF 的限制。

【问题讨论】:

    标签: html firefox jsf


    【解决方案1】:

    JSF 所做的只是生成 HTML/CSS/JS。 Webbrowsers 根本不检索/理解 JSF 代码。样式和外观通常使用 CSS 进行控制。您所能做的就是查看生成的 HTML/CSS/JS 代码,以获取与禁用按钮的样式相关的指针。你也许可以创建一个普通的 HTML 页面来做一些快速测试来排除一个和另一个。

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <title>Test</title>
        </head>
        <body>
            <input type="submit" disabled>
        </body>
    </html>
    

    您可以使用 CSS 中的属性选择器[name=value] 选择禁用的提交按钮,如下所示:

    input[type=submit][disabled] {
        background: pink;
    }
    

    如下测试:

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <title>Test</title>
            <style>input[type=submit][disabled] { background: pink; }</style>
        </head>
        <body>
            <input type="submit" disabled>
        </body>
    </html>
    

    并将学到的东西应用到JSF端。

    【讨论】:

    • 正如你所说,我尝试了同样的方法,我为 mozilla 安装了 firebug。当我看到属性列表时,在萤火虫中没有找到禁用的属性。但是在 IE 的 IE 开发人员工具栏中,我可以找到禁用的属性。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-02
    • 2011-06-05
    • 2015-07-29
    • 1970-01-01
    • 2018-08-14
    • 1970-01-01
    • 2018-08-25
    相关资源
    最近更新 更多