javascript - Am I using onchange incorrectly? -
I am trying to put a value ( key
) which is a number corresponding update A text box ( angle
) is divided by a value ( 25
). However, for some reason, the changeMe
function does not execute. Is I misusing the exchange?
& lt; Script type = "text / javascript" & gt; The function changes in (x) {var y = document.getElementById (x) .value; Y = (y / 25); Y = (around mathematics (y)); Document.getElementById (key) .Value = y; } & Lt; / Script & gt; & Lt; Form method = "POST" verb = "" & gt; Your angle: & lt; Input type = "text" name = "angle" id = "angle" onchange = "changeMe (this.id)" value = "0" /> Key: & lt; Span id = "key" & gt; 0 & lt; / Span & gt; & Lt; Br / & gt; & Lt; / Form & gt;
change line
document.getElementById (key ) .Value = y;
to
document.getElementById ('key'). InnerHTML = y;
Comments
Post a Comment