function updateTimeSpan() {
var theSpan = document.getElementById('timeLeft');
var d = new Date();
var t = new Date();
var ms;
var s, m, h;
// if it's after 5pm, set today to tomorrow
if (d.getHours() > 16){ d.setDate(d.getDate() + 1); }
// get the next monday
while (d.getDay() != 1){ d.setDate(d.getDate() + 1); }
// set the time
d.setHours(23);
d.setMinutes(18);
d.setSeconds(0);
// get the difference between right now and next monday
ms = d - t;
// get the days between now and then
d = parseInt(ms / (1000 * 60 * 60 * 24));
ms -= (d * 1000 * 60 * 60 * 24);
// get hours
h = parseInt(ms / (1000 * 60 * 60));
ms -= (h * 1000 * 60 * 60);
// get minutes
m = parseInt(ms / (1000 * 60));
ms -= (m * 1000 * 60);
// get seconds
s = parseInt(ms / 1000);
theSpan.innerHTML = d + ' days, ' + h + ' hours, ' + m + ' minutes, and ' + s + ' seconds.';
setTimeout('updateTimeSpan()', 100);
}
onload = updateTimeSpan();
$(function() {
$("h2")
.wrapInner("<span>")
$("h2 br")
.before("<span class='spacer'>")
.after("<span class='spacer'>");
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.