묻고답하기
배송마감 안내 자바스크립트 만들려고 합니다.
2016.06.08 17:44
<form name="baesong_time">
<table width="850" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height="40"></td></tr>
<tr>
<td valign="top" style="background:url(http://llsugill.godohosting.com/timg_bg.gif) no-repeat 0 0; padding-left:217px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width:85px;font-size:50px;color:#ffffff;height:80px;" align="center"><span id="si">0</span></td>
<td width="80"></td>
<td style="width:85px;font-size:50px;color:#ffffff;" align="center"><span id="bunn1">0</span></td>
<td width="52"></td>
<td style="width:85px;font-size:50px;color:#ffffff;" align="center"><span id="cho1">0</span></td>
</tr>
</table>
</td>
</tr>
<tr><td height="30"></td></tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td align="center">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<!--금일 배송마감까지 남은 시간 ( 16시 까지) :
<input type=text name="count_delivery" readonly size="20" onFocus=this.blur()>-->
</td>
</tr>
<Script Language="JavaScript">
var starttime=1464801800;
var endtime=1464821600;
var retime=1000;
function retime_st(){setTimeout('counttime()',retime);}
function counttime(){
starttime++;
hh=0;
mm=0;
ss=0;
now_time=parseInt(endtime-starttime);
if(now_time<=0) now_time=0;
hh=parseInt(now_time/3600);
now_timem=now_time-hh*3600;
mm=parseInt(now_timem/60);
ss=now_timem-mm*60;
if(now_time>=0){
//document.baesong_time.count_delivery.value=hh+"시간 "+mm+"분 "+ss + "초";
document.getElementById("si").innerHTML = ""+hh+"";
document.getElementById("bunn1").innerHTML = ""+mm+"";
//document.getElementById("bunn2").innerHTML = ""+mm+"";
document.getElementById("cho1").innerHTML = ""+ss+"";
//document.getElementById("cho2").innerHTML = ""+ss+"";
}
if(now_time<=0){
document.getElementById("si").innerHTML = "--";
document.getElementById("bunn1").innerHTML = "--";
//document.getElementById("bunn2").innerHTML = "-";
document.getElementById("cho1").innerHTML = "--";
//document.getElementById("cho2").innerHTML = "-";
return;
} else {
setTimeout('counttime()',retime);
}
}
retime_st();
</Script>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
여기 소스에서
var starttime=1464801800;
var endtime=1464821600;
var retime=1000;
시작시간을 현재시간 끝나는시간을 오후 4시로 바꿔야하는데 어떻게 해야할지 모르겠습니다.
지금은 무조건 5시 30분부터 카운트를 시작합니다. 도와주시면 감사하겠습니다.