jsp- how to assign input value into another variable I would like to use later?

the problem is

when I say:

alert(parseInt(document.frmFuture.txtDays.value) + 7);

(value is number that user input) it shows fine.

but when I say:

var tmp = document.frmFuture.txtDays.value;
alert(tmp + 7);

it gives me undefined.

Actually, I want to do some cals later using the input number. But it looks like impossible? how can i do that?

Answers


You forgot the parseInt.

var tmp = parseInt(document.frmFuture.txtDays.value);
alert(tmp + 7);

Now it should work.


Need Your Help

How does this code generate the proper sequence of characters?

php math obfuscation captcha

The code in question comes from MathGuard, a PHP anti-spam CAPTCHA script that requires the user to answer a simple math problem. It displays the digits and operator symbols as 3x5 matrices of random

2 beans with same name but in different packages; how to autowire them?

spring inversion-of-control autowired

I have an application that has 2 beans with the same name, but which are in different packages. My Spring application fails because it cannot decide on which bean to take. Is there any solution for...