VBScript TypeName Function
TypeName function returns a subtype of a specified variable.
TypeName function returns the following values:
- Byte - represents a byte value
- Integer - represents an integer value
- Long - represents a long integer
- Single - represents a single-precision floating-point values
- Double - represents a double-precision floating-point value
- Currency - represents a monetary value
- Decimal - represent a decimal value
- Date - represents a date or time value
- String - A string value represents
- Boolean - indicates a Boolean value, True or False
- Empty - represents an uninitialized variable
- Null - means no valid data
- <Object type> - represents the actual name of the object type
- Object - represents generic object
- Unknown - Unknown object type represents
- Nothing - not yet represent a reference to an object variable object instance
- Error - indicates an error
grammar
TypeName(varname)
参数 | 描述 |
---|---|
varname | 必需。变量的名称。 |
Examples
Examples
<script type="text/vbscript">
x="Hello World!"
document.write(TypeName(x) & "<br />")
x=4
document.write(TypeName(x) & "<br />")
x=4.675
document.write(TypeName(x) & "<br />")
x=Null
document.write(TypeName(x) & "<br />")
x=Empty
document.write(TypeName(x) & "<br />")
x=True
document.write(TypeName(x))
</script>
x="Hello World!"
document.write(TypeName(x) & "<br />")
x=4
document.write(TypeName(x) & "<br />")
x=4.675
document.write(TypeName(x) & "<br />")
x=Null
document.write(TypeName(x) & "<br />")
x=Empty
document.write(TypeName(x) & "<br />")
x=True
document.write(TypeName(x))
</script>
Examples of the above output:
String
Integer
Double
Null
Empty
Boolean
Integer
Double
Null
Empty
Boolean
try it"
Complete VBScript Reference