我想根据状态更改背景颜色

时间:2018-06-18 11:30:55

标签: maven-plugin

我想根据状态更改背景颜色。 如果它处于活动状态,那么它应该是绿色的。

<td id="txtSuppStatus"><c:out value="${dashSupList.supplierStatus }"/></td> 
 <script type="text/javascript">
    function checkFilled()
    {
        var supplierStatus = document.getElementById("txtSuppStatus");

           if(supplierStatus == "Active")
            {
               supplierStatus.style.backgroundColor = "green";
            }
           else
               {
                 document.getElementById('txtSuppStatus').setAttribute( "class", "label label-danger  label-mini" );
               } 

    }
   </script>

1 个答案:

答案 0 :(得分:0)

是的,我得到了答案。

                                            <c:choose> 
                                            <c:when test="${dashMaintenanceList.maintenanceStatus == 'In Progress'}">           
                                            <td><c:out value="${dashMaintenanceList.assetTag}"/></td>               
                                    <td><c:out value="${dashMaintenanceList.maintenanceType}"/></td>    

                               <td><span class="label label-info"><c:out value="${dashMaintenanceList.maintenanceStatus}" /></span></td>        
                                            </c:when>   

                                            <c:when test="${dashMaintenanceList.maintenanceStatus == 'Repaired'}">          
                                            <td><c:out value="${dashMaintenanceList.assetTag}"/></td>               
                                    <td><c:out value="${dashMaintenanceList.maintenanceType}"/></td>                   
                            <td><span class="label label-success  label-mini"><c:out value="${dashMaintenanceList.maintenanceStatus}" /></span></td>                
                                            </c:when>   

                                    <c:when test="${dashMaintenanceList.maintenanceStatus == 'To be initiated'}">
                                <td><c:out value="${dashMaintenanceList.assetTag}"/></td>               
                                <td><c:out value="${dashMaintenanceList.maintenanceType}"/></td>                   
                    <td><span class="label label-primary"><c:out value="${dashMaintenanceList.maintenanceStatus}" /></span></td>        
                                </c:when>


                                           </c:choose>
                                    </c:forEach>