VBScript TypeName 函數
定義和用法
TypeName 函數可指定變量的子類型。
TypeName 函數可返回的值:
| 值 | 描述 |
|---|---|
| Byte | 字節(jié)值 |
| Integer | 整型值 |
| Long | 長整型值 |
| Single | 單精度浮點值 |
| Double | 雙精度浮點值 |
| Currency | 貨幣值 |
| Decimal | 十進制值 |
| Date | 日期或時間值 |
| String | 字符串值 |
| Boolean | Boolean 值;True 或 False |
| Empty | 未初始化 |
| Null | 無有效數據 |
| <object type> | 實際對象類型名 |
| Object | 一般對象 |
| Unknown | 未知對象類型 |
| Nothing | 還未引用對象實例的對象變量 |
| Error | 錯誤 |
語法
TypeName(varname)
| 參數 | 描述 |
|---|---|
| varname | 必需的。變量的名稱。 |
實例
dim x x="Hello World!" document.write(TypeName(x)) x=4 document.write(TypeName(x)) x=4.675 document.write(TypeName(x)) x=Null document.write(TypeName(x)) x=Empty document.write(TypeName(x)) x=True document.write(TypeName(x))
輸出:
String Integer Double Null Empty Boolean