javascript - Input box will not "forget" the first value it gets Firefox 20.0 -


the problem have input box not forgetting first input gets. feeds when content should have been on written new input. code using works fine ie8 problem seen firefox 20.0.

i working entirely in javascript. there no html beyond body.

i use set input box:

addelementwithidbutnonode("input","manimp","div42"); // add input box addelementwithnodeandid("button","set","div42","setbutton"); //add "set" button document.getelementbyid("setbutton").onclick=showit; 

"manimp" id , below captures entered first time around "themainvar".

function showit()   {   themainvar=manimp.value;   themainvar=parsefloat(themainvar);   alert(themainvar);   } 

the problem if run again in firefox can enter value alert comes entered first time around.

you can manually sent "manimp.value" else in javascript , change stays stuck @ changed value.

i need "reset manimp can accept new value input box function"

i have had around , found lots of "reset()" , "clear()" funcitons nothing works me.

the same thing happens if swap input box drop down.

i'm new javascript if fix seem obvious you, maybe is!

try getting 'manimp' element inside function, value referenced when function declared. so, inside function use

themainvar = document.getelementbyid('manimp').value;


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -