Javascript Clock Time Code for HTML Web Dev 2015
Page 1 of 1
Javascript Clock Time Code for HTML Web Dev 2015
http://www.w3schools.com/html/html_colors.asp
- Code:
<style>
#date_time {
background-color:#000099;
position:absolute;
bottom:0;
right:0;
}
</style>
- Code:
<script type="text/javascript" language="javascript">
// RenderTime Code 2015 (c) J~Net 2015 ALL RIGHTS RESERVEDfunction date_time(id)
function date_time(id) {
date = new Date;
year = date.getFullYear();
month = date.getMonth();
months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'Jully', 'August', 'September', 'October', 'November', 'December');
d = date.getDate();
day = date.getDay();
days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
h = date.getHours();
if(h<10)
{
h = "0"+h;
}
m = date.getMinutes();
if(m<10)
{
m = "0"+m;
}
s = date.getSeconds();
if(s<10)
{
s = "0"+s;
}
result = ''+days[day]+' '+d+' '+months[month]+' '+h+':'+m+':'+s+' '+year+'' ;
// result = ''+days[day]+' '+months[month]+' '+d+' '+year+' '+h+':'+m+':'+s;
document.getElementById(id).innerHTML = result;
setTimeout('date_time("'+id+'");','1000');
return true;
}
</script>
- Code:
<span id="date_time" style="color:#00FF66"></span>
<script type="text/javascript">window.onload = date_time('date_time');</script>
Similar topics
» Javascript html offline and online project examples
» Object Oriented JavaScript 2015
» Include file containing sound if time is less than code
» NodeMCU ESP8266 NIST Time Clock Plus Web Server
» TUT AND CODE EXAMPLES AND SITE LINKS For Javascript & More
» Object Oriented JavaScript 2015
» Include file containing sound if time is less than code
» NodeMCU ESP8266 NIST Time Clock Plus Web Server
» TUT AND CODE EXAMPLES AND SITE LINKS For Javascript & More
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum