VBScript Abs Function
Abs function returns the absolute value of the specified number.
Note: If thenumber parameter contains Null, returns Null.
Note: If thenumber parameter is an uninitialized variable, zero is returned.
grammar
Abs(number)
参数 | 描述 |
---|---|
number | 必需。一个数值表达式。 |
Examples
Example 1
<script type="text/vbscript">
document.write(Abs(1) & "<br />")
document.write(Abs(-1))
</script>
document.write(Abs(1) & "<br />")
document.write(Abs(-1))
</script>
Examples of the above output:
1
1
1
try it"
Example 2
<script type="text/vbscript">
document.write(Abs(48.4) & "<br />")
document.write(Abs(-48.4))
</script>
document.write(Abs(48.4) & "<br />")
document.write(Abs(-48.4))
</script>
Examples of the above output:
48.4
48.4
48.4
try it"
Complete VBScript Reference