Latest web development tutorials

VBScript Round function

VBScript Reference Complete VBScript Reference

Round function numbers rounding.

grammar

Round(expression[,numdecimalplaces])

参数 描述
expression 必需。需要被四舍五入的数值表达式。
numdecimalplaces 可选。规定对小数点右边的多少位进行四舍五入。默认是 0。

Examples

Example 1

<script type="text/vbscript">

document.write(Round(24.13278) & "<br />")
document.write(Round(24.75122))

</script>

Examples of the above output:

24
25

try it"

Example 2

How a rounded numbers, 2 decimal places:

<script type="text/vbscript">

document.write(Round(24.13278,2))

</script>

Examples of the above output:

24.13

try it"

VBScript Reference Complete VBScript Reference