vbscript - 经典ASP格式数字制作数字0.0

标签 vbscript asp-classic

我正在尝试获取小数点后两位的小数值...

我希望获得一些数字的平均值,然后将它们显示在表格中..

这是我的代码,然后是我的输出

<% response.write(rsTemp("8over") & "<BR>") %>
<% response.write(rsTemp5("qty") & "<BR>") %>

<% PercentageOver = rsTemp("8over")/rsTemp5("qty")%>

<% response.write(PercentageOver & "<BR>") %>

<% PercentageOver = FormatNumber(PercentageOver,2) %>

<% response.write(PercentageOver) %>

输出:

2
618
3.23624595469256E-03
0.00

我做错了什么?我尝试过各种各样的东西,比如 CDbl 等......

最佳答案

您的号码是 E-03 (×10-3),因此前 3 位数字中没有非零数字。

?FormatNumber(PercentageOver, 3)
0.003

关于vbscript - 经典ASP格式数字制作数字0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36015253/

相关文章:

arrays - VBScript 中 LBound 的意义/用途是什么?

asp.net-mvc - MVC 对于一个经典的 ASP 人来说容易学习吗

asp.net - 获取 "This type of page is not served",如何在本地机器上的 Visual Studio 中运行经典 asp?

soap - 使用经典 ASP 发送 'application/soap+xml' SOAP 请求

javascript - 下拉菜单中的 OnClick() 事件

sql-server - ADO 参数化查询不返回任何结果

error-handling - 抑制整个脚本的错误

c# - 绑定(bind)到使用 CreateObject 创建的已打开表单

vbscript - 使用vbscript替换文本文件中的多个文本

javascript - 经典 ASP Javascript 引用中的 'this.value' 是什么意思?