VBScript ChrFunction


VBScript 参考手册Complete VBScript Reference

The Chr function converts the specified ANSI character code to a character.

Note:Numbers from 0 to 31 represent non-printable ASCII codes. For example, Chr(10) will return a line feed character.

Syntax

Chr(charcode)

Parameter Description
charcode Required. A number that identifies a character.

Example

Example 1

<script type="text/vbscript">

document.write(Chr(65) & "<br />")
document.write(Chr(66) & "<br />")
document.write(Chr(67) & "<br />")
document.write(Chr(97) & "<br />")
document.write(Chr(98) & "<br />")
document.write(Chr(99) & "<br />")

</script>

The output of the above example is:

A
B
C
a
b
c

Try it Yourself »

Example 2

<script type="text/vbscript">

document.write(Chr(34) & "<br />")
document.write(Chr(35) & "<br />")
document.write(Chr(36) & "<br />")
document.write(Chr(37) & "<br />")

</script>

The output of the above example is:

"
#
$
%

Try it Yourself »

VBScript 参考手册Complete VBScript Reference Other Extensions