I'm trying to have a value (key
) that updates to correspond with a number in a textbox (angle
) divided by a value (25
). However, for some reason, the changeMe
function doesn't seem to be executing. Am I using onchange incorrectly?
<script type="text/javascript">
function changeMe(x)
{
var y=document.getElementById(x).value;
y = (y/25);
y = (Math.round(y));
document.getElementById(key).value=y;
}
</script>
<form method="POST" action="">
Your Angle: <input type="text" name="angle" id="angle"
onchange="changeMe(this.id)" value="0"/>
Key: <span id="key">0</span><br />
</form>