Skip to content

Instantly share code, notes, and snippets.

@chikoski
Created October 16, 2013 08:15
Show Gist options
  • Save chikoski/7004342 to your computer and use it in GitHub Desktop.
Save chikoski/7004342 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>ボタンが押されるとカウントアップするデモ</title>
</head>
<body>
<p id="counter">0</p>
<form>
<input id="btn_countup" type="button" value="カウントアップ!">
</form>
</body>
</html>
var count = -1;
var countup = function(event){
var output = document.getElementById("counter");
count = count + 1;
output.textContent= count;
};
var btn = document.getElementById("btn_countup");
btn.onclick = countup;
countup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment