日期:2009-11-10  浏览次数:20889 次

返回一个 Boolean 值,指明枚举算子是否位于集合的末尾。

myEnum.atEnd()

必选项 myEnum 参数是任意 Enumerator 对象。

说明
如果当前项是集合中的最后一个,或者集合为空,或者当前项没有定义,那么 atEnd 方法将返回 true 。否则返回
false 。

示例
在下面的代码中,使用了 atEnd 方法来决定是否到达了一个驱动器列表的末尾:

function ShowDriveList(){
var fso, s, n, e, x;
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives);
s = "";
for (; !e.atEnd(); e.moveNext())
{
x = e.item();
s = s + x.DriveLetter;
s += " - ";
if (x.DriveType == 3)
n = x.ShareName;
else if (x.IsReady)
n = x.VolumeName;
else
n = "[驱动器未就绪]";
s += n + "<br>";
}
return(s);
}
要求
版本 2