day = math.floor 1000*60*60*24이렇게 쓰기 귀찮아서 그냥..짜봤어요..누군가 필요할 수도 있을거란 생각에 공유드립니다 https://codepen.io/derrickmckeown/pen/KLDhk?css-preprocessor=sass 위 코드펜 참고해서 만들엇는데 시와 분이 반올림이 안되어있어서 수정해놨어요 마크업도 별도로해놨으니..CSS는 꾸미시면 되실거라.. <script type="text/javascript"> function flowtime(){ chantime_m = setTimeout("timebar_m()", 1000); } function timebar_m(){ var ti = document.all.timebox_m.value; ti = ti - 1; if(ti < 1){ document.all.result_m.value = "end count"; }else{ var sec = ti % 60; var min = (ti - sec) / 60; window.document.all.sec_m.value = sec; window.document.all.min_m.value = min; window.document.all.timebox_m.value = ti; chantime = setTimeout("timebar_m()", 1000); } } function cleartime(){ clearTimeout(chantime_m); } flowtime(); </script> <body> <input type ="text" name = "timebox_m" value = "120" size = "10"> 초 <br> <input type ="text" name = "min_m" value = "120" size = "3"> 분 <br> <input type ="text" name = "sec_m" value = "120" size = "3"> 초 <br> <input type ="text" name = "result_m"> </body> |