Date and time on the site




If you need to show the current time and date on the page, then this script is just for you.

The script can easily be installed on a separate page anywhere, or on the entire site.

<script>
function clock() {
var d = new Date();
var month_num = d.getMonth()
var day = d.getDate();
var hours = d.getHours();
var minutes = d.getMinutes();
var seconds = d.getSeconds();
month=new Array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");
if (day <= 9) day = "0" + day;
if (hours <= 9) hours = "0" + hours;
if (minutes <= 9) minutes = "0" + minutes;
if (seconds <= 9) seconds = "0" + seconds;
date_time = day + "." + month[month_num] + "." + d.getFullYear() + " г.   "+ hours + ":" + minutes + ":" + seconds;
if (document.layers) {
document.layers.doc_time.document.write(date_time);
document.layers.doc_time.document.close();
}
else document.getElementById("doc_time").innerHTML = date_time;
setTimeout("clock()", 1000);
}
</script>

Then, in the place where you must have a string with the date and time, the html and the start script are prescribed.

You can also write them in the end, and then position in the styles to where you want and make the design.

<span id="doc_time"></span>
<script>
clock();
</script>
<style>
    #doc_time{
    font-family: Impact;
    color: #999;
    font-style: italic;
    position: absolute;
    top: 10px;
    left: 30px;
}
</style>

I wish you creative success.

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

Leave a Reply

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