將集合中的當(dāng)前項(xiàng)移動(dòng)到下一項(xiàng)。
enumObj.moveNext( )
必選項(xiàng) myEnum 參數(shù)是任意 Enumerator 對(duì)象。
如果枚舉算子位于集合的最后,或者集合為空,那么當(dāng)前項(xiàng)將被設(shè)置為 undefined。
在下面的例子中,使用了 moveNext 方法在 Drives 集合中向下一個(gè)驅(qū)動(dòng)器移動(dòng):
function ShowDriveList(){
var fso, s, n, e, x; // 聲明變量。
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives); // 創(chuàng)建 Enumerator 對(duì)象。
s = ""; //初始化 s。
for (; !e.atEnd(); e.moveNext()
)
{
x = e.item();
s = s + x.DriveLetter; // 加驅(qū)動(dòng)器號(hào)
s += " - "; // 加 "-" 字符。
if (x.DriveType == 3)
n = x.ShareName; // 加共享名。
else if (x.IsReady)
n = x.VolumeName; // 加卷名。
else
n = "[驅(qū)動(dòng)器未就緒]"; // 指明驅(qū)動(dòng)器未就緒。
s += n + "\n";
}
return(s); // 返回驅(qū)動(dòng)器狀態(tài)。
}
atEnd 方法 | item 方法 | moveFirst 方法
應(yīng)用于: Enumerator 對(duì)象