Last active
August 29, 2015 14:09
-
-
Save ambienttraffic/0bd21faecd6a3e8a8734 to your computer and use it in GitHub Desktop.
Wine O Matic
This file contains 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<!-- begin form --><form style="background:#3d414a;color:#fff;padding:12px;"><h4 style="text-align:center;font-family:prenton,helvetica,sans-serif;font-weight:600;margin-bottom:12px;color:#fff;text-transform:uppercase">The Serious Eats Thanksgiving Wine Calculator</h4><div style="max-width:300px;margin: 0 auto"><label style="float:left;margin-right: 6px;font-family:prenton,helvetica,sans-serif;text-transform: uppercase;width:240px;text-align:right;color:#fff">Party Duration (hours):</label><input type="number" id="duration" name="duration" min="0" value=3 onkeypress="return isnumber(event)" style="display:inline-block;max-width: 40px"> | |
<label style="clear:left;float:left;margin-right: 6px;font-family:prenton,helvetica,sans-serif;text-transform: uppercase;width:240px;text-align:right;color:#fff">Number of Guests:</label><input type="number" id="guests" name="guests" min="0" value=10 onkeypress="return isnumber(event)" style="display:inline-block;max-width: 40px"></div><div style="text-align:center;clear:left"><input type="button" value="Crunch Numbers" onclick="dowork()" style="display:inline-block;margin-bottom:6px;background:#fff;border:2px solid #ff3600;color:#ff3600;border-radius:0;text-transform:uppercase;padding:4px 6px"></div><div id="results" style="min-height:30px;font-size:1.5em;font-weight:bold;text-align:center;color:#edbf36;margin-top:9px"></div> | |
</form><script>function isnumber(e){var t=e.which?e.which:event.keyCode;if(t>31&&(t<48||t>57))return false;return true}function dowork(){var e=document.getElementById("duration").value;var t=document.getElementById("guests").value;var n=0;if(e>=1){n=t*2;n+=t*(e-1)}else n=t*2*e;bottleCount=Math.ceil(n/4);document.getElementById("results").innerHTML="You need "+n+" glasses. Get "+bottleCount+" bottles."}</script><!-- end form --> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment