67 lines
1.5 KiB
HTML
67 lines
1.5 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>Scrabble Score</title>
|
|
<style>
|
|
html {
|
|
background-color: #eee;
|
|
}
|
|
|
|
div.score {
|
|
display: inline-block;
|
|
font-family: monospace, sans-serif;
|
|
font-weight: bold;
|
|
position: relative;
|
|
text-align: center;
|
|
width: 49%;
|
|
}
|
|
|
|
div.score span { font-size: 20vw; }
|
|
|
|
.score.p1 { color: darkblue; }
|
|
.score.p2 { color: darkred; }
|
|
.score.p3 { color: darkgreen; }
|
|
.score.p4 { color: black; }
|
|
|
|
input {
|
|
border: none;
|
|
border-bottom: solid thin black;
|
|
font-family: monospace;
|
|
font-size: 4vw;
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: 0;
|
|
width: 24%;
|
|
}
|
|
</style>
|
|
|
|
<script type="text/javascript">
|
|
console.log("Loaded");
|
|
function updateScore(event, player) {
|
|
if (event.key != 'Enter') return;
|
|
var sbEl = document.querySelector('.score.' + player + ' span');
|
|
sbEl.innerHTML = +(sbEl.innerHTML) + +(event.target.value);
|
|
event.target.value = "";
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="p1 score">
|
|
<span class>0</span>
|
|
<input onkeypress="updateScore(event, 'p1')" name=p1 type=number />
|
|
</div>
|
|
<div class="p2 score">
|
|
<span class>0</span>
|
|
<input onkeypress="updateScore(event, 'p2')" name=p2 type=number />
|
|
</div>
|
|
<div class="p3 score">
|
|
<span class>0</span>
|
|
<input onkeypress="updateScore(event, 'p3')" name=p3 type=number />
|
|
</div>
|
|
<div class="p4 score">
|
|
<span class>0</span>
|
|
<input onkeypress="updateScore(event, 'p4')" name=p4 type=number />
|
|
</div>
|
|
</body>
|
|
</html>
|