item 方法 (JScript)
更新:2007 年 11 月
返回集合中的当前项。
function item() : Number
备注
item 方法返回 Enumerator 对象中的当前项。如果集合为空或如果当前项未被定义,它将返回 undefined。
示例
在下面的代码中,使用了 item 方法返回 Drives 集合中的一个成员。
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 = "[Drive not ready]";
s += n + "<br>";
}
return(s);
}