Countdown counter

Need such a counter on the site? If so, read the article, copy the code, and post it on the pages of your site.

Days Hours Minutes Seconds

The counter counts the time until a certain date that you set.

Most often this is the day, hour, minute of the end of sales.

But if you show creative imagination, then you can decorate congratulations with this gadget.

Well, or designate the end of the world.

The script is not large, very easy and does not affect the page load speed in any way, since it is loaded last.

Code:


<script>
timeend= new Date(2018, 11, 20); // Meter stop date
function Timer() {
today = new Date();
today = Math.floor((timeend-today)/1000);
tsec=today%60;
today=Math.floor(today/60);
if(tsec<10)tsec='0'+tsec; tmin=today%60; today=Math.floor(today/60); if(tmin<10)tmin='0'+tmin; thour=today%24; today=Math.floor(today/24); document.getElementById('d').innerHTML=today; document.getElementById('h').innerHTML=thour; document.getElementById('m').innerHTML=tmin; document.getElementById('s').innerHTML=tsec; window.setTimeout("Timer()",1000); } </script>

<style>
.count {
margin: 0;
padding: 0;
text-align: center;
color: red;
font-family: Impact;
}
.table {
font-size: 18px;
}
th, td {
border-radius: 5px;
background: rgba(255, 215, 0, .6);
}
th {
font-size: 29px;
}
<style>

<body class="count" onload="Timer()">
<table align="center" cellspacing="5" cellpadding="5">
<tr>
<th><span> id="d"></span></th>
<th><span> id="h"></span></th>
<th><span> id="m"></span></th>
<th><span> id="s"></span></th>
</tr>
<tr>
<td>Дней</td>
<td>Часов</td>
<td>Минут</td>
<td>Секунд</td>
</tr>
</table>
</body>

To install the counter on one page of the site on the CMS, as in this article, script and html are inserted directly onto the page, and styles into the style.css file.

If the counter is needed on all pages, then script and html are placed either in the header.php file or in the footer.php file, anywhere.

I wish you creative success.

This entry was posted in Free Scripts Ready Code. Bookmark the permalink.
А так же:

Leave a Reply

Your email address will not be published. Required fields are marked *