JS) 음악 재생
2020. 12. 14. 00:43
Backend 언어 및 프레임워크
const plyBtn = document.querySelector(".play-music"); const pusBtn = document.querySelector(".pause-music"); let music = new Audio("music/1.mp3"); function playMusic() { if (music.isplaying) { //실행중일때는 한번 더 실행하지 않도록 return; } else { music.play(); } } function pauseMusic() { music.pause(); } function init() { plyBtn.addEventListener("click", playMusic); pusBtn.addEventListener("click", pauseMusic..

JS) 새로고침 할 때 이벤트
2020. 12. 12. 20:06
Backend 언어 및 프레임워크
const remove = function () { window.onbeforeunload = () => { localStorage.removeItem(USER_LS); localStorage.removeItem(weight); }; }; function init() { loadWeight(); remove(); } init();
JS) 시간 및 요일 함수
2020. 12. 12. 20:06
Backend 언어 및 프레임워크
function dayday() { const date = new Date(); const day = date.getDay(); const dayDay = [ "일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일", ]; return dayDay[day]; } function getTitle() { const date = new Date(); const hours = date.getHours(); const minutes = date.getMinutes(); const seconds = date.getSeconds(); const year = date.getFullYear(); const month = date.getMonth() + 1; const dayd = dayday..