Dear all, I have function javascript like this function display_short_lived_counter(seconds, div_name) { orig_seconds = seconds; if (seconds <= 0) { el = document.getElementById(div_name);
if (el) { el.innerHTML = '00:00:00'; } return; } hours = 0; minutes = 0; interval = 1000; if (seconds >= 3600) { hours = Math.floor(seconds/3600); seconds = Math.floor(seconds-(3600*hours)); } if (seconds >= 60) { minutes = Math.floor(seconds/60); seconds = Math.floor(seconds-(60*minutes)); } el = document.getElementById(div_name); if (el) { if (hours < 10) { hours = '0' + hours; } if (minutes < 10) { minutes = '0' + minutes; } if (seconds < 10) { seconds = '0' + seconds; } el.innerHTML = hours + ':' + minutes + ':' + seconds; orig_seconds -= 1; window.setTimeout("display_short_lived_counter(" + orig_seconds + ", \"" + div_name + "\")", interval); } } <script type="text/javascript"> $(document).ready(function(){ display_short_lived_counter(3600,'server_time2'); display_short_lived_counter(1800,'server_time3'); }); </script> It will show countdown like this : 00:01:00 00:00:30 I wont use script php like this, so countdown depend on item on table item $rs=mysql_query("select TIME_TO_SEC(itm_date_expired)-TIME_TO_SEC(itm_date_start) time_diff from item"); while ($dt=mysql_fetch_array($rs)) { // how can i call function display_short_lived_counter () this block?? } Thanks