使用javascript/jquery从字符串中获取整数值

13 浏览
0 Comments

使用javascript/jquery从字符串中获取整数值

这是我拥有的字符串:

"test123.00"
"yes50.00"

我想将123.00和50.00相加。

我该如何做?

我使用了parseInt()命令,但在弹出框中显示NaN错误。

这是代码:

 str1 = "test123.00";
 str2 = "yes50.00";
 total = parseInt(str1)+parseInt(str2);
 alert(total);

0