Created
May 2, 2013 06:13
-
-
Save chikoski/5500446 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>JS Bin</title> | |
</head> | |
<body> | |
<p> | |
実数:<input type="text" id="input"> | |
</p> | |
<p> | |
切り捨てられた数:<input type="text" id="output"> | |
</p> | |
<input type="button" id="start" value="切り捨て!"> | |
</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 clickHandler = function(){ | |
var input, output; | |
input = document.getElementById("input"); | |
output = document.getElementById("output"); | |
var value = input.value; | |
console.log(value); | |
value = Number(value); | |
console.log(value); | |
value = Math.floor(value); | |
output.value = value; | |
}; | |
var btn; | |
btn = document.getElementById("start"); | |
btn.onclick = clickHandler; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment