Skip to content

Commit

Permalink
This has to be my tiniest git project ever
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandR committed Oct 31, 2014
0 parents commit 0c2a290
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>
0 - Counter
</title>
<style>
body{
font-family: sans-serif;
text-align: center;
}
h1{
font-size: 5em;
line-height: 1em;
font-weight: normal;
cursor: pointer;
}
</style>
</head>
<body>
<h1 id="counter" onclick="increment();">0</h1>
<p>Press enter (or click the number) to increment, press delete to decrement.</p>
</body>
<script type="text/javascript">

var counter = 0;

function increment(){
counter++;
document.getElementById("counter").innerHTML = counter;
document.title = counter + " - Counter";
}

function decrement(){
counter--;
document.getElementById("counter").innerHTML = counter;
document.title = counter + " - Counter";
}

document.onkeypress = function(event) {
var key = event.keyCode || event.which;
if(key == 13){
increment();
} else if(key == 127){
event.preventDefault();
decrement();
}
}


</script>
</html>

0 comments on commit 0c2a290

Please sign in to comment.