function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matthew AllenMatthew Allen 

visualforce conditional banner

Hi,

I have the below code. Could someone help me change it so that the colour of the banner changes based on the days_since_update_2__c field please? ideally something like, >60 Red, >30 Amber else Green.

I know it's a lot to ask but hopefully you can help.

Matt
 
<apex:page standardController="Group_Relationship__c" >
<div id='MyCustomHeaderBanner' style='width: 100%; float: left;'></div>
<script>
         window.onload = function() {
                    var myBannerHTML = "<div style='background-color: lightgrey; width: 100%; float: Centre;font-family:calibri;font-size:16px;color:black;text-align:center;'>  Action plan last updated by &nbsp{!Group_Relationship__c.Last_Update_By__c} {!Group_Relationship__c.Days_since_update_2__c} </div>";
                     document.getElementById("MyCustomHeaderBanner").innerHTML = myBannerHTML;
         };
         
         
</script>

</apex:page>

 
Matthew AllenMatthew Allen
Sorry, make that based on the Days_since_update__c field (no 2)
Raj VakatiRaj Vakati
tr this
 
var myBannerHTML = "<div style=' background-color:{!CASE(Group_Relationship__c.Days_since_update__c  <= 30, 'red', Group_Relationship__c.Days_since_update__c   > 20 && Group_Relationship__c.Days_since_update__c   <= 40, 'green',  'pink')}; width: 100%; float: Centre;font-family:calibri;font-size:16px;color:black;text-align:center;'>  Action plan last updated by &nbsp{!Group_Relationship__c.Last_Update_By__c} {!Group_Relationship__c.Days_since_update_2__c} </div>";