Hi all,
I need some help about a result very strange for me?
I write a specific technical calculator. When ‘calculate’ is clicked the program has to print some results by document.write(…).
Inside it is called a function which returns a value as next:
// k_a , k_b – values taken from text input
function evalDeep(k_a,k_b){
var res=0;
var marg = 0.2;
k_a=parseFloat(k_a);
k_b=parseFloat(k_b);
res = k_a – k_b;
if (res > [B]user_input_text
alert(“too much”);
}
return res.toFixed(2)
}
The problem is in user_input_text – if I put a simple value for exam. 1.2 it works OK. If I try to interprete the real input it crashes. I try to do that as follows:
var x;
function detInput(){
x=document.getElementById(“deep”); //deep is txt input where the number is // typed
var y=parseFloat(x.value);
return y;
}
and instead of user_input_text in the first func. is detInput(). It returns the value but the execution stops! Any idea what’s wrong? Please help