Last active
August 29, 2015 14:02
-
-
Save krschmidt/9c71e202ccbb9aa576dd to your computer and use it in GitHub Desktop.
Weeks Elapsed + % Elapsed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Weeks Elapsed</title> | |
</head> | |
<body> | |
<div id="container" style="width:100%; height:50px; border:1px solid black;"> | |
<div id="progress-bar" style="width:50%; | |
background-color:black; | |
height:50px;"> | |
</div> | |
</div> | |
<p style="text-align:center;"><span id="progress-percent"></span> of this course is complete!</p> | |
<p style = "text-align:center;"><span id="weeksElapsed"></span> of <span id="weeksTotal"></span> weeks have passed</p> | |
<script> | |
var start = new Date(2014,5,9), | |
end = new Date(2014,7,2), | |
today = new Date(); | |
var elapsed = Math.round(((today - start) / (end - start)) * 100) + '%'; | |
document.getElementById("weeksElapsed").innerHTML = Math.round((today - start) / 604800000); | |
document.getElementById("weeksTotal").innerHTML = Math.round(totalWeeks = (end - start) / 604800000); | |
document.getElementById("progress-bar").style.width = elapsed; | |
document.getElementById("progress-percent").innerHTML = elapsed; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment