发信人: wuga(冰雨梦)
整理人: wuga(2001-12-30 08:39:43), 站内信件
|
描述
重新将集合中的当前项设置为第一项。
语法
myEnum.moveFirst( )
myEnum 参数是任意 Enumerator 对象。
说明
如果集合中没有项,那么当前项将被设置为 undefined 。
在下面的例子中,使用了 moveFirst 方法从列表的开始处对 Drives 集合的成员进行计算:
function ShowFirstAvailableDrive()
{
var fso, s, e, x;
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives);
e.moveFirst();
s = "";
do
{
x = e.item();
if (x.IsReady)
{
s = x.DriveLetter + ":";
break;
}
else
if (e.atEnd())
{
s = "No drives are available";
break;
}
e.moveNext();
}
while (!e.atEnd());
return(s);
}
|
|