Skip to content

Instantly share code, notes, and snippets.

@catoidrobo
Created February 12, 2016 09:25
Show Gist options
  • Save catoidrobo/14b473ba95b95981e140 to your computer and use it in GitHub Desktop.
Save catoidrobo/14b473ba95b95981e140 to your computer and use it in GitHub Desktop.
form1に値をいれるとform2に値が勝手に入る。今回は小数点第3位以下を切り捨てにした場合
<script>
function space(self) {
document.forms['form_name'].elements['form2'].value = Math.floor(self.value * 100) / 100;
}
</script>
<input type="text" name="form1" value="" onchange="space(this);" />
<input type="text" name="form2" value="" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment