$(window).load(function(){ countup(); getHoliday(); }); function countup(){ var now = new Date(); //var xxday = new Date(1976, 4, 15); var xxday = new Date($("#StartDate_y").val(), $("#StartDate_m").val() -1, $("#StartDate_d").val()); var t = Math.ceil( ( now.getTime() - xxday.getTime() ) / 1000 ); var d = Math.floor( t/( 60*60*24 ) ) + Number($("#DayCnt").val()); var h = Math.floor( t%( 60*60*24 )/(60*60) ); var m = Math.floor( t%( 60*60 )/60 ); var s = t%60; if($("#NowFlg").val() == "0"){ d = Number($("#DayCnt").val()); h = 0; m = 0; s = 0; } //alert($("div#counter span.d").html()); $("#counter .d").html(d); $("#counter .h").html(h); $("#counter .m").html(m); $("#counter .s").html(s); setTimeout('countup()',1000); } function getHoliday() { }