Code Monkey home page Code Monkey logo

dom_assignment's Introduction

DOM Homework

One of the great things about JavaScript is that it lets you manipulate the contents of a Web page in real-time. This means that we can use JavaScript to create a digital clock, embedded in the Web page, that updates every second.

Todays class can be found in the dom folder

Digital Clock

To build a digital clock we need to utilize the date class from the JavaScript Library

  • var date = new Date()
  • date.getHours()
  • date.getMinutes()
  • date.getSeconds()

The most important function for this task is is the setInterval() function. The setInterval(fn, time) takes 2 parameters. One a function and the other is duration in milliseconds.

The task

  • Build a digital clock to show just like a digital wristwatch will show the time. i.e. 01:30:03 PM

  • Include a button to toggle the time from 12hrs format to 24hours format.(means have ONE button to change the time format)

You might want to check out the .toggle() method in the JQuery library.

Analogue Clock

We all loved that old fashion grandfather clock.

Img folder has all required images

The task

Using JavaScript, HTML5, CSS3. Build an analogue clock that ticks.

  • Seconds hand must rotate 360 degrees
  • Minutes hand must move after every 60 seconds.
  • Hour hand must move after every 60 minutes

Hints: If a circle is 360 degrees and 15mins is 90 degrees then 90/15 is 6 degrees which makes 1 minute.

Champions Only

  • Create a text box that takes city name and displays a new clock based on timezone of that city. e.g. Riyadh - GMT+3, Zhengzhou - GMT+8, Lagos - GMT+1

Useful Links

dom_assignment's People

Contributors

i-am-ebere 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.