Added simple scorekeeper project.

This commit is contained in:
Jonathan Bernard 2016-10-27 20:59:28 -05:00
parent cad9df9ead
commit 12c3980f92

View File

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<title>Scrabble Score</title>
<style>
html {
background-color: #eee;
}
div.score {
display: inline-block;
font-family: monospace, sans-serif;
font-size: 20vw;
font-weight: bold;
text-align: center;
width: 49%;
}
.score.elijah {
color: darkblue;
}
input {
border: none;
border-bottom: solid thin black;
font-family: monospace;
font-size: 10vw;
margin: 1rem 12%;
width: 24%
}
</style>
<script type="text/javascript">
console.log("Loaded");
function updateScore(event, player) {
if (event.key != 'Enter') return;
var sbEl = document.getElementsByClassName(player)[0];
sbEl.innerHTML = +(sbEl.innerHTML) + +(event.target.value);
event.target.value = "";
}
</script>
</head>
<body>
<div class="elijah score">
0
</div>
<div class="jdb score">
0
</div>
<input onkeypress="updateScore(event, 'elijah')" name=elijah type=number />
<input onkeypress="updateScore(event, 'jdb')" name=jdb type=number />
</body>
</html>