JavaScript Basics: How to Develop for Multiple Platforms


show more Learn how to create a countdown website with JavaScript. In this example, Simon Allardice shows how to combine what you've learned about JavaScript, including custom elements, functions, timers, math objects, and more, into a web page that shows alerts and dynamically updates content. show less
please wait ...

Example: Countdown

So let's put several of these ideas together. I'm going to run through a few examples to use the techniques and the concepts we have already explored in combination with each other. And the first example I going to do here is this Countdown page, where I can type into the text box, put in, say, 3, and click the button to say Start Countdown, and I get this little JavaScript timer going on. And this is not spectacularly impressive, I grant you, but as you'll see, it's a good example of several techniques put together.

Now step one, I have chosen to make this page as simple as possible, so we can focus on the script. And in fact, if I look at the HTML here, I can see there really isn't much going on. I have got a little bit of basic CSS at the top, but body of the page itself is simply a container div which inside has another div which has nothing in it and one h1. And in fact on this page itself I don't have the HTML for the text box or this button. I'm going to g...

Example: Countdown
Video duration: 8m 3s 5h 31m Beginner

Viewers:

Learn how to create a countdown website with JavaScript. In this example, Simon Allardice shows how to combine what you've learned about JavaScript, including custom elements, functions, timers, math objects, and more, into a web page that shows alerts and dynamically updates content.

Subjects:
Developer Web
Software:
JavaScript
Author:
please wait ...