- 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
廣告