Create Function In Function and Global Variable Declaration :
function showTime(){
var date = new Date();
var m=date.getMonth("MON");
var dd=date.getDate();
var y=date.getFullYear();
var h = date.getHours(); // 0 - 23
var m = date.getMinutes(); // 0 - 59
var s = date.getSeconds(); // 0 - 59
var session = "AM";
if(h == 0){
h = 12;
}
if(h > 12){
h = h - 12;
session = "PM";
}
h = (h < 10) ? "0" + h : h;
m = (m < 10) ? "0" + m : m;
s = (s < 10) ? "0" + s : s;
//var time =dd +""+ m +"" + y +","+ h + ":" + m + ":" + s + " " + session;
var time = h + ":" + m + ":" + s + " " + session;
document.getElementById("MyClockDisplay").innerText = time;
document.getElementById("MyClockDisplay").textContent = time;
setTimeout(showTime, 1000);
}
$(document).ready(function(){
$(".t-Body-contentInner").prepend("<div id='MyClockDisplay' class='clock'></div>");
showTime();
});
Inline :
body {
background: black;
}
.clock {
position: relative;
left: 95%;
transform: translateX(-50%) translateY(-50%);
color: darkslategrey;
font-size: 14px;
font-family: Orbitron;
font-weight: bold;
letter-spacing: 4px;
}
No comments:
Post a Comment