 |
|
|  |
| 알람시계 (설정된 시간이 되면 경고창으로 알려줍니다.) |
|
|
 |
19년 전 |
<HTML>
<HEAD>
<TITLE>xtx.kr</TITLE>
</head>
<body>
<form name=exf1>
<B>알람설정 :</B>
<input type=text name=h size=2>시 <input type=text name=m size=2> 분 <input type=text name=s size=2>초
<input type=button name=b onclick=setAlarm() value="Set Alarm"><input type=button name=r onclick=clearAlarm() value="Turn Alarm Off"><BR>
<B>현재시간 :</B>
<input type=text name=ch size=2>시<input type=text name=cm size=2>분 <input type=text name=cs size=2>초
</form>
<script>
<!--
var alarmTimer = null;
var alarmSet;
function setAlarm() { alarmSet = true; }
function clearAlarm() { alarmSet = false; }
function initAlarm() {
if (alarmTimer!=null)clearInterval(alarmTimer);
var nowTime = new Date();
clearAlarm();
document.exf1.h.value = nowTime.getHours();
document.exf1.m.value = nowTime.getMinutes();
document.exf1.s.value = nowTime.getSeconds();
alarmTimer=setInterval("countTime()",1000);
}
function matchH() { return (document.exf1.ch.value == document.exf1.h.value); }
function matchM() { return (document.exf1.cm.value == document.exf1.m.value); }
function matchS() { return (document.exf1.cs.value == document.exf1.s.value); }
function countTime() {
var nowTime = new Date();
document.exf1.ch.value = nowTime.getHours();
document.exf1.cm.value = nowTime.getMinutes();
document.exf1.cs.value = nowTime.getSeconds();
if (matchH() && matchM() && matchS()) {
alert("뚜뚜뚜뚜...일어나세요... ");
}
}
onload=initAlarm;
//-->
</script>
</body>
</html> |
|
추천 : 645 |
추천
목록
|
|
|  |
|