[英]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?
我怎样才能做到这一点?
You forgot the parseInt
. 您忘记了
parseInt
。
var tmp = parseInt(document.frmFuture.txtDays.value);
alert(tmp + 7);
Now it should work. 现在应该可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.