最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
JScript 方法 - item 方法
时间:2022-06-30 11:18:04 编辑:袖梨 来源:一聚教程网
返回集合中的当前项。
enumObj.item()
必选项 myEnum 参数为任意 Enumerator 对象。
说明
item 方法返回当前项。
如果集合为空或者当前项没有定义,那么将返回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 = "[驱动器未就绪]";
s += n + "
";
}
return(s);
}
要求
版本 3
enumObj.item()
必选项 myEnum 参数为任意 Enumerator 对象。
说明
item 方法返回当前项。
如果集合为空或者当前项没有定义,那么将返回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 = "[驱动器未就绪]";
s += n + "
";
}
return(s);
}
要求
版本 3
相关文章
- .Net行为型设计模式之状态模式(State) 09-17
- .Net行为型设计模式之观察者模式(Observer) 09-17
- .Net行为型设计模式之迭代器模式(Iterator) 09-17
- .Net行为型设计模式之命令模式(Command) 09-17
- .Net行为型设计模式之模板方法模式(Template Method) 09-17
- .Net结构型设计模式之代理模式(Proxy) 09-17