var CountDown = { intDiff: 10 } function fnUpdateTime() { $("#last_time").text(--CountDown.intDiff); if (CountDown.intDiff!=0) { setTimeout("fnUpdateTime()", 1000) } else { alert(78); } } $(function () { setTimeout("fnUpdateTime()", 1000) });