The problem with the date field is that they all end up at the INPUT tag level with the same ID. This means that you can't go directly to the date field input element. It is therefore neccessary to traverse through the DOM tree to get to it. This example is for date only fields. I will do another version for date time fields.
//--------------------------------------------------------------------------------------------------
function setDateColors( tFieldName, tColor, tBackgroundColor, tFontWeight ) {
//--------------------------------------------------------------------------------------------------
var tBaseElement = window.document.getElementById( tFieldName );
var tElement = tBaseElement.childNodes[1].childNodes[0].childNodes[0].childNodes[0].style;
tElement.color = tColor;
tElement.backgroundColor = tBackgroundColor;
tElement.fontWeight = tFontWeight;
};
an example of how this might be called is (to make it bold white text on red background):
setDateColors( new_startDate, "#ffffff", "#ff0000", "bold" )
No comments:
Post a Comment