Skip to content

Instantly share code, notes, and snippets.

@flsafe
Forked from nithinbekal/wc10.html
Created September 16, 2010 04:39
Show Gist options
  • Save flsafe/581966 to your computer and use it in GitHub Desktop.
Save flsafe/581966 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>World Cup 2010 Countdown Timer</title>
</head>
<body>
<div id="worldcup_countdown_time"> </div>
<script src="wc10.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
/*
Code from javascript countdown timer example at:
http://nithinbekal.com/2009/12/06/javascript-how-to-create-a-simple-countdown-timer/
*/
function updateWCTime() {
now = new Date();
kickoff = new Date.parse("June 11, 2010 11:30:00");
diff = kickoff - now;
days = Math.floor( diff / (1000*60*60*24) );
hours = Math.floor( diff / (1000*60*60) );
mins = Math.floor( diff / (1000*60) );
secs = Math.floor( diff / 1000 );
dd = days;
hh = hours - days * 24;
mm = mins - hours * 60;
ss = secs - mins * 60;
// document.getElementById("worldcup_countdown_time").innerHTML = dd + ' days<br/>' + hh + ' hours<br/>' + mm + ' minutes<br/>' + ss + ' seconds' ;
document.getElementById("worldcup_countdown_time")
.innerHTML =
dd + ' days ' +
hh + ' hours ' +
mm + ' minutes ' +
ss + ' seconds' ;
}
setInterval('updateWCTime()', 1000 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment