Latest web development tutorials

VBScript Hex function

VBScript Reference Complete VBScript Reference

Hex function returns a string representing the hexadecimal value of a specified number.

Note: If the parameter is not an integer, making it rounded to the nearest integer before the operation.

grammar

Hex(number)

参数 描述
number 必需。任何有效的表达式。

如果数字是:

  • Null - 那么 Hex 函数返回 Null。
  • Empty - 那么 Hex 函数返回零(0)。
  • Any other number - 那么 Hex 函数返回 8 个十六进制字符。

Examples

Examples

<script type="text/vbscript">

document.write(Hex(3) & "<br />")
document.write(Hex(5) & "<br />")
document.write(Hex(9) & "<br />")
document.write(Hex(10) & "<br />")
document.write(Hex(11) & "<br />")
document.write(Hex(12) & "<br />")
document.write(Hex(400) & "<br />")
document.write(Hex(459) & "<br />")
document.write(Hex(460) & "<br />")

</script>

Examples of the above output:

3
5
9
A
B
C
190
1CB
1CC

try it"

VBScript Reference Complete VBScript Reference