특정 시간대에 Alert창을 띄우는 스크립트
<input type="button" value="click" onclick=clickToOpen()>
<script>
function clickToOpen(){
//해당하는 시간에 alert 생성
var today = new Date();
var currentTime = today.getHours();
console.log(currentTime+"current Time");
if(currentTime>0 && currentTime<7){
alert("0시 ~ 7시 사이에는 신청불가합니다.");
}
}
</script>
728x90
'Learning > Javascript' 카테고리의 다른 글
테이블 목록 번호 재정렬하기 (0) | 2023.08.27 |
---|---|
이미지 클릭시 크게보이는 모달창 구현 (0) | 2022.10.13 |
웹페이지 카카오톡으로 공유하기 (0) | 2022.10.13 |
폼 데이터 출력 (0) | 2022.08.30 |