Created
October 16, 2013 08:15
-
-
Save chikoski/7004342 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
<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> |
This file contains hidden or 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
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