Latest web development tutorials

VBScript Array function

VBScript Reference Complete VBScript Reference

Array function returns a variable that contains an array.

Note: The first element in the array is zero.

grammar

Array(arglist)

参数 描述
arglist 必需。数组中元素值的列表(由逗号分割)。

Examples

Example 1

<script type="text/vbscript">

a=Array(5,10,15,20)
document.write(a(3))

</script>

Examples of the above output:

20

try it"

Example 2

<script type="text/vbscript">

a=Array(5,10,15,20)
document.write(a(0))

</script>

Examples of the above output:

5

try it"

Example 3

Iterate all the items:

<script type="text/vbscript">

a=Array(5,10,15,20)
for each x in a
document.write(x & "<br />")
next

</script>

Examples of the above output:

5
10
15
20

try it"

VBScript Reference Complete VBScript Reference