Code Monkey home page Code Monkey logo

electronic-clock's Introduction

electronic-clock

use html and javascript

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta http - equiv = "Content-Type" content = "text/html; charset=utf-8" / > < title > 电子时钟 < / title > < script > window.onload = function () { showTime(); } function checkTime(i) { if (i < 10) { i = "0" + i; } return i; } function showTime() { var myDate = new Date(); var year = myDate.getFullYear(); var month = myDate.getMonth() + 1; var date = myDate.getDate(); var day = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; var hour = myDate.getHours(); var minute = myDate.getMinutes(); minute = checkTime(minute); var second = myDate.getSeconds(); second = checkTime(second); document.getElementById("show").innerHTML = year + '年' + month + '月' + date + '日' + day[myDate.getDay()] + hour + ':' + minute + ':' + second; setTimeout(showTime, 1000); } < / script > < / head > < body > < div id = "show" > < / div > < / body > < / html >

electronic-clock's People

Contributors

86cyc86 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.