- VBScript 教程
- VBScript - 主页
- VBScript - 概述
- VBScript - 语法
- VBScript - 启用
- VBScript - 放置
- VBScript - 变量
- VBScript - 常量
- VBScript - 运算符
- VBScript - 决策
- VBScript - 循环
- VBScript - 事件
- VBScript - Cookie
- VBScript - 数字
- VBScript - 字符串
- VBScript - 数组
- VBScript - 日期
- VBScript 高级
- VBScript - 过程
- VBScript - 对话框
- VBScript - 面向对象
- VBScript - 正则表达式
- VBScript - 错误处理
- VBScript - 杂项语句
- VBScript 有用资源
- VBScript - 问题与解答
- VBScript - 快速指南
- VBScript - 有用资源
- VBScript - 讨论
VBScript Erase 函数
Erase 函数用于重置固定大小数组的值和释放动态数组的内存。它的行为取决于数组的类型。
语法
Erase ArrayName
固定数字数组,数组中的每个元素都重置为零。
固定字符串数组,数组中的每个元素都重置为零长度“ ”。
对象数组,数组中的每个元素都重置为特殊值 Nothing。
示例
<!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> Dim NumArray(3) NumArray(0) = "VBScript" NumArray(1) = 1.05 NumArray(2) = 25 NumArray(3) = #23/04/2013# Dim DynamicArray() ReDim DynamicArray(9) ' Allocate storage space. Erase NumArray ' Each element is reinitialized. Erase DynamicArray ' Free memory used by array. ' All values would be erased. Document.write("The value at Zeroth index of NumArray is " & NumArray(0) & "<br />") Document.write("The value at First index of NumArray is " & NumArray(1) & "<br />") Document.write("The value at Second index of NumArray is " & NumArray(2) & "<br />") Document.write("The value at Third index of NumArray is " & NumArray(3) & "<br />") </script> </body> </html>
当上述代码另存为 .HTML 并在 Internet Explorer 中执行时,它将生成以下结果 −
The value at Zero index of NumArray is The value at First index of NumArray is The value at Second index of NumArray is The value at Third index of NumArray is
vbscript_arrays.htm
广告