타이머 종료시 딱한번만 새로고침되게 수정을 좀부탁드려요 정보
타이머 종료시 딱한번만 새로고침되게 수정을 좀부탁드려요본문
<script language="JavaScript">
<?
$tgap = strtotime($au[au_to_datetime]) - time();
$tday = (int)($tgap / 86400);
$thour = (int)(($tgap - ($tday * 86400)) / 3600);
$tmin = (int)(($tgap - ($tday * 86400 + $thour * 3600)) / 60);
$tsec = (int)($tgap - ($tday * 86400 + $thour * 3600 + $tmin * 60));
?>
var tday = <?=$tday?>;
var thour = <?=$thour?>;
var tmin = <?=$tmin?>;
var tsec = <?=$tsec?>;
function runtimer()
{
var s = "";
if (tday > 0)
s += tday + "일";
if (thour > 0 || s != "") {
if (s != "") s += " ";
s += thour + "시간";
}
if (tmin > 0 || s != "") {
if (s != "") s += " ";
s += tmin + "분";
}
if (tsec > 0 || s != "") {
if (s != "") s += " ";
s += tsec + "초";
}
if (s == "") {
document.fdetail.timer.value = " 종료";
return;
}
document.fdetail.timer.value = s;
tsec--;
if (tsec < 0) {
tsec = 59;
tmin--;
}
if (tmin < 0) {
tmin = 59;
thour--;
}
if (thour < 0) {
thour = 23;
tday--;
}
window.setTimeout('runtimer()',1000);
}
</script>
위에걸로 어케해야될지....막막하네요
구분자를 넘기면될것같은데 도저히 되질않는군요
걍 복사해서 붙여넣기로 할수있게끔 수정좀 부탁드립니다.
<?
$tgap = strtotime($au[au_to_datetime]) - time();
$tday = (int)($tgap / 86400);
$thour = (int)(($tgap - ($tday * 86400)) / 3600);
$tmin = (int)(($tgap - ($tday * 86400 + $thour * 3600)) / 60);
$tsec = (int)($tgap - ($tday * 86400 + $thour * 3600 + $tmin * 60));
?>
var tday = <?=$tday?>;
var thour = <?=$thour?>;
var tmin = <?=$tmin?>;
var tsec = <?=$tsec?>;
function runtimer()
{
var s = "";
if (tday > 0)
s += tday + "일";
if (thour > 0 || s != "") {
if (s != "") s += " ";
s += thour + "시간";
}
if (tmin > 0 || s != "") {
if (s != "") s += " ";
s += tmin + "분";
}
if (tsec > 0 || s != "") {
if (s != "") s += " ";
s += tsec + "초";
}
if (s == "") {
document.fdetail.timer.value = " 종료";
return;
}
document.fdetail.timer.value = s;
tsec--;
if (tsec < 0) {
tsec = 59;
tmin--;
}
if (tmin < 0) {
tmin = 59;
thour--;
}
if (thour < 0) {
thour = 23;
tday--;
}
window.setTimeout('runtimer()',1000);
}
</script>
위에걸로 어케해야될지....막막하네요
구분자를 넘기면될것같은데 도저히 되질않는군요
걍 복사해서 붙여넣기로 할수있게끔 수정좀 부탁드립니다.
댓글 전체