On many sites, you can see a timer counting down until a specific event occurs. This can be the end time of the discounts or the time remaining until the New Year. Such timers are a great advertising move that stimulates the activity of buyers / suppliers, as well as a good interactive variety for the site.
Necessary
a countdown timer script
Instructions
Step 1
To set such a timer on your website, first download the countdown timer script. Then configure two parameters in it: the countdown date and the corresponding inscription, which will be shown when this date comes.
Step 2
Opening the downloaded archive, you will find 2 files: one contains the script countdown.js, and the other serves as an example of the page to which this script will be connected - index.html. First, extract the files from the archive.
Step 3
Use Notepad to edit the script file. To open the specified file in Notepad, right-click on it. In the menu that appears, select the "Open" item, then select "with - Notepad".
Step 4
Edit the first line at the very beginning of the file: var eventstr = "Happy New Year!". This inscription will be displayed at the end of the countdown. The second line with the countdown date is located at the end of the file and looks like this: CountDowndmn (2011, 1, 1) in the format year, month, day.
Step 5
Edit the script fragment, which is also located at the end of the file, slightly above the countdown date: countdownid.innerHTML = "+ dday +" "+ ddaystr +", "+ dhour +" "+ dhourstr +", "+ dmin +" " + dminstr + "and" + dsec + " + dsecstr.
Step 6
Save the resulting file and place it in the directory where the page of your site where the timer will be placed is located. In other words, the timer page file and the script file must be in the same directory.
Step 7
Next, in a convenient place to place the timer, in the code of your page, put 2 lines:
DIV "center" ID = "countdown">.
Step 8
The first line is responsible for the command to display the timer. The second is for connecting the created script.
Step 9
Check your timer is working. If everything is done correctly, then you will see a countdown in the right place on the page of your site.