자바스크립트
자바스크립트 - 접속시간 띄우기
yes or yes
2017. 8. 14. 15:12
반응형
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<style type="text/css">
.clock{
font-family:tahoma;
font-size:240pt;
color:#006699;
}
</style>
<script language = "javascript">
var conntectedDate = new Date();
function showElapsedTime()
{
var divClock = document.getElementById("divClock");
var currentDate = new Date();
var result = Math.cell((currentDate - connectedDate) / 1000);
divClock.innerText = "이 페이지에 접속 후" + result;
divClock.innerText += "초가 지났습니다.;
setTimeout(showElapsedTime, 1000);
}
</script>
</head>
<body onload="showElapsedTime()">
<div id = "divClock" class="clock"> </div>
</body>
</html>
반응형