尝试添加变量时出现NaN错误

NaN error when trying to add variables

本文关键字:NaN 错误 添加 变量      更新时间:2023-09-26

当我将它与其他代码一起运行时,一切都很好,除了这个!我只是收到一些东西说£NaN0,我不明白为什么它不是一个数字,有人请帮助!

您发布的代码是好的,但您没有发布的代码不是。

我运行你的代码与蓝图/VPS的东西注释掉,它工作得很好。我猜你的问题在这里:

var userChoiceBlueprntVal = blueprtSelected.options[blueprtSelected.selectedIndex].value;
var userChoiceBlueprntValint = parseInt(userChoiceBlueprntVal);

userChoiceBlueprntVal的结果是什么?更有可能的是,它不是int型,这使得userChoiceBlueprntValint为NaN,随后所有剩下的计算都是NaN。

如果你不能从这里修复它,发布你所有的代码