moveNext 方法
更新:2007 年 11 月
将当前项移到 Enumerator 对象中的下一项。
function moveNext()
备注
如果枚举数位于集合的末尾,或集合为空,则当前项将被设置为未定义。
在以下示例中,使用 moveNext 方法在 Drives 集合中移动到下一个驱动器:
function ShowDriveList(){
var fso, s, n, e, x; //Declare variables.
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives); //Create Enumerator object.
s = ""; //Initialize s.
for (; !e.atEnd(); e.moveNext())
{
x = e.item();
s = s + x.DriveLetter; //Add drive letter
s += " - "; //Add "-" character.
if (x.DriveType == 3)
n = x.ShareName; //Add share name.
else if (x.IsReady)
n = x.VolumeName; //Add volume name.
else
n = "[Drive not ready]"; //Indicate drive not ready.
s += n + "\n";
}
return(s); //Return drive status.
}