웹마스터 팁

타이머

2008.11.29 20:16

*이종민*

타이머 소스입니다.

<html>
<head>
<title>타이머</title>
<script language="JavaScript">
<!--
var gap = 1000; //남은초 기본값
function msg_time()
{
 m = Math.floor(gap/60)+"분 "+(gap%60)+"초";
// window.status = m;
 document.all.x.innerHTML="<font color='red'>" + m + "</font> 남았습니다.";
 gap--;
 if(gap<0)
 {
  clearInterval(tid);
 }
}
//-->
</script>
</head>
<body onLoad="tid=setInterval('msg_time()',1000);">
<center>
    <div id="layer1" style="width:182px; height:17px; position:absolute; left:683px; top:164px; z-index:1;">
        <p><div id="x"></div></p>
    </div>
</center>
</body>
</html>