Change Row background color based on time
Change Row background color based on time
Hi,
at first sorry for my bad english. I have a column with times in the format H: i. When the time displayed in the column with the real time is the same, the background should be in color. So I tried it:
............code............
<?php
$timestamp = time();
$time_now = date("H:i", $timestamp);
<
script type="text/javascript" charset="utf-8">
$(document).ready( function () {
var oTable = $('#example').dataTable( {
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
if ( aData[2] == "$time_now" )
{
$('td', nRow).css('background-color', '#E4FFDF');
}
},
............code............
Unfortunately it does not work. When I enter the time directly e.g. as follows:
if (aData [2] == "19:15")
Then it works. It will probably not recognize $ time_now. What am I doing wrong?
Stumpi
Answers
Sorry, the code will be displayed here without any line breaks...?!
Stumpi