【问题标题】:Changing the value and background color of commandButton upon oncomplete在完成时更改 commandButton 的值和背景颜色
【发布时间】:2014-09-05 06:25:07
【问题描述】:

我是素面的新手,我想知道是否有一种方法可以在支持 bean 中的方法完成时更改命令按钮的值和背景颜色。到目前为止,我仍然想不出同时做这两个的方法。有什么建议吗?

【问题讨论】:

    标签: jsf primefaces


    【解决方案1】:

    你可以调用JavaScript函数来改变按钮的颜色

    <p:commandButton value="click" id="btn1" actionListener="#{something}"  preocess="@this" oncomplete="changeColor()" />
    
    <script>
    
    function changeColor(){
    document.getElementById('btn1').style.background='red';
    }
    
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-25
      • 1970-01-01
      • 2017-07-21
      • 2018-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-17
      相关资源
      最近更新 更多