I had explained on this blog site earlier how to change the properties of fields from client side scripts. One of the case scenarios that I came across recently is to change the color of Date field based on some condition. Here is the script written on the custom content which does the job.
//’Function to call onload
function OpportunityOnLaod()
{
//’ChangeTextColorDate
ChangeTextColorDate(“oppo_opened”,”Red”);
}
//Function to change the date value color for date field
function ChangeTextColorDate(pcFieldname,TextColor)
{
var sFieldName = new String(pcFieldname);
sFieldName = sFieldName.toLowerCase();
var sTextColor = new String(TextColor);
var HdnFldName = ‘_Data’+sFieldName;
if(eval(“document.EntryForm.”+sFieldName))
{
eval(“document.EntryForm.”+sFieldName+”.style.color ='”+sTextColor+”‘”);
}
if(eval(document.getElementById(HdnFldName)))
{
eval(“document.getElementById(HdnFldName).style.color='”+sTextColor+”‘”);
}
}