Javascript countdown (desktop notification)
This article describes how to implement the countdown Effect of javascript. Share it with you for your reference. The details are as follows:
After the weekend, we have a countdown to work and have fun.
Make sure the following three points:
1. HTML5 desktop notifications have been enabled for non-ie browsers in Chrome versions. For specific settings, see the following
2. Place the HTML file on the Local Web server for testing. Double-click it to run it. A desktop notification cannot be displayed.
By the way, this program can easily be extended to timed notifications.
There are two tangled points in the process of doing this:
1. parseInt ("09") returns 0. The correct method is parseInt ("09", 10), explicitly specifying the base number as decimal
2. false and "false". This is also a bit difficult.
$ ("# Minute"). attr ("readonly", "false ");
But it does not reach the effect. In fact, the readonly attribute only has two values: true or false. Therefore, if I set its value to "false ", it is equivalent to setting (convert a non-null string to a Boolean value ):
$ ("# Minute"). attr ("readonly", true );
Update:
I fixed some bugs and realized that the sentence "It seems very simple and not so easy".
Shows the running effect:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I hope this article will help you design javascript programs.