Skip to content

Instantly share code, notes, and snippets.

@chikoski
Created May 2, 2013 06:13
Show Gist options
  • Save chikoski/5500446 to your computer and use it in GitHub Desktop.
Save chikoski/5500446 to your computer and use it in GitHub Desktop.
<!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>
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