사이트 내 전체검색
홈에 머무른 시간 표시
로빈아빠
https://cmd.kr/javascript/111 URL이 복사되었습니다.

본문

<html>
<head>
<SCRIPT language=JavaScript>
function startTimer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
enterTime=hours*3600+mins*60+secs;
Timer();
}
 
function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs
timeSpent();
}

function timeSpent(){
count = curTime - enterTime;
if (count > 3600)
hour = parseInt(count/3600);
else
hour = 0
 
if (count > 60)
min = parseInt(count/60);
else
min = 0
if (min < 10)
min = "0" + min

sec = parseInt(count - min*60)
if (sec < 0)
sec = "0" + sec
document.timer.counter.value = hour + ":" + min + ":" + sec
window.setTimeout("Timer()",1000)
}

</SCRIPT>
</head>
<body>
<body onload="startTimer();">

<form name="timer" method="get">
손님이 오신지 <input type="text" name="counter" size="9" style="border-style:none;">지났습니다.
</form>
</body>
</html>

출처 : http://qdata.co.kr/bo/bbs/board.php?bo_table=jt&wr_id=55

댓글목록

등록된 댓글이 없습니다.

831 (17/17P)

Search

Copyright © Cmd 명령어 3.147.103.15