how to make digital clock using javascript and show me an example. > BASIC_ORIGINAL

본문 바로가기

사이트 내 전체검색

뒤로가기 BASIC_ORIGINAL

페이지 정보

작성자 최고관리자 작성일 23-04-08 01:58 조회 632 댓글 0
기관명 how to make digital clock using javascript and show me an example.
대표
연락처
웹주소
업종
주소
사진
기관 소개내용
질문: how to make digital clock using javascript and show me an example.



You can use the following code example to create a digital clock in JavaScript:

<html>
<body>
<script type="text/javascript">
  function startTime() {
    var today = new Date();
    var h = today.getHours();
    var m = today.getMinutes();
    var s = today.getSeconds();
    m = checkTime(m);
    s = checkTime(s);
    document.getElementById('clock').innerHTML =
    h + ":" + m + ":" + s;
    var t = setTimeout(startTime, 500);
  }
  function checkTime(i) {
    if (i < 10) {i = "0" + i};  // add zero in front of numbers < 10
    return i;
  }
</script>

<h1>Digital Clock Using JavaScript</h1>
<div id = "clock" style="font-size:50px;"></div>

<script type="text/javascript">
  startTime();
</script>

</body>
</html>
찾아오는길

댓글목록 0

등록된 댓글이 없습니다.


로또번호 만들기

Copyright © EGIS.KR All rights reserved.

사이트 정보

Kim's Company / CEO : Kimchulyong
Contact : kimchulyong100@gmail.com

PC 버전으로 보기