moveNext 方法
更新:2007 年 11 月
將 Enumerator 物件中目前的項目移至下一項。
function moveNext()
備註
如果列舉值是位於集合物件的結尾處或集合物件是空的,目前的項目就會設成 undefined。
在以下範例中,使用 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.
}