返回集合中的當(dāng)前項(xiàng)。
enumObj.item()
必選項(xiàng) myEnum 參數(shù)為任意 Enumerator 對(duì)象。
item 方法返回當(dāng)前項(xiàng)。如果集合為空或者當(dāng)前項(xiàng)沒有定義,那么將返回undefined 。
在下面的代碼中,使用了 item 方法返回 Drives 集合中的一個(gè)成員。
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 = "[驅(qū)動(dòng)器未就緒]";
s += n + "<br>";
}
return(s);
}
atEnd 方法 | moveFirst 方法 | moveNext 方法
應(yīng)用于: Enumerator 對(duì)象