메뉴 건너뛰기
여기에 파일을 끌어 놓거나 파일 첨부 버튼을 클릭하세요.
파일 크기 제한 : 0MB (허용 확장자 : *.*)
파일 업로드 중... (0%)
브라우저를 닫더라도 로그인이 계속 유지될 수 있습니다.로그인 유지 기능을 사용할 경우 다음 접속부터는 로그인할 필요가 없습니다.단, 게임방, 학교 등 공공장소에서 이용 시 개인정보가 유출될 수 있으니 꼭 로그아웃을 해주세요.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title></title>
<style></style>
<script></script>
</head>
<body>
<h2>타이머</h2>
<hr>
<span id="timer">타이머 카운트</span><br>
<button type="button" id="start" onclick="start(event)">start</button>
<button type="button" id="stop" onclick="stop(event)">stop</button>
<script>
var worker = null;
var span = document.getElementById("timer");
function start(e) {
if (worker != null)
return;
else{
worker = new Worker("timer.js");
worker.onmessage = function (e) {
span.innerHTML = e.data;
}
worker.postMessage("start");
}
}
function stop(e) {
worker.postMessage("stop");
worker = null;
}
</script>
</body>
</html>