JSFiddle - React, Tailwind, and code Playground
by bluey
HTML
<span id="spanDate">....Initializing....</span>
<span id="spanDate2">....Initializing....</span>
JavaScript
/*
every second,
create random char from regex,
write char "different of previous one" to each class='num'AS-span.child of timer.
*/
function stopclock(){
if(timerRunning){
clearTimeout(timerID);
timerRunning = false;
}
}
function startclock(){
stopclock();
showtime();
}
function showtime(){
var now = new Date();
var end = new Date("2015/07/30 21:59:00");
var thedifDate = end - now;
var difDate = new Date(thedifDate);
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var nDays = difDate.getDay();
var nHours = difDate.getHours();
var nMinutes = difDate.getMinutes();
var nSeconds = difDate.getSeconds();
var nMseconds = difDate.getMilliseconds();
var timestring = "";
timestring += ((hours < 10) ? "0" : "") + hours;
timestring += ((minutes < 10) ? ":0" : ":") + minutes;
timestring += ((seconds < 10) ? ":0" : ":") + seconds;
var timestring = "";
timestring += ((hours < 10) ? "0" : "") + hours;
timestring += ((minutes < 10) ? ":0" : ":") + minutes;
timestring += ((seconds < 10) ? ":0" : ":") + seconds;
var ntimestring = "";
ntimestring += ((nDays < 10) ? "0" : "") + nDays;
ntimestring += ((nHours < 10) ? ":0" : "") + nHours;
ntimestring += ((nMinutes < 10) ? ":0" : ":") + nMinutes;
ntimestring += ((nSeconds < 10) ? ":0" : ":") + nSeconds;
ntimestring += ((nMseconds < 100) ? "00:" : ":") + nMseconds;
var numbers = {
'0': 'ø',
'1': '†',
'2': '‡',
'3': 'ƒ',
'4': 'ß',
'5': 'Æ',
'6': 'Ð',
'7': 'þ',
'8': '¿',
'9': 'œ'
};
var theTimeString = timestring;
//var theNewTimeString = ntimestring;
var theNewTimeString =...