Bagikan melalui


moveNext Method

Moves the current item to the next item in the Enumerator object.

function moveNext()

Remarks

If the enumerator is at the end of the collection or the collection is empty, the current item is set to undefined.

In following example, the moveNext method is used to move to the next drive in the Drives collection:

function ShowDrives()
{
    var s = "";

    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var e = new Enumerator(fso.Drives);

    e.moveFirst();
    while (e.atEnd() == false)
    {
        var x = e.item();

        s += x.DriveLetter;
        s += " - ";

        if (x.DriveType == 3)
            s += x.ShareName;
        else if (x.IsReady)
            s += x.VolumeName;
        else
            s += "[Drive not ready]";

        s += "\n";

        e.moveNext();
    }
    return(s);
}

Requirements

Version 3

Applies To:

Enumerator Object

See Also

Reference

atEnd Method

item Method (Visual Studio - JScript)

moveFirst Method

Change History

Date

History

Reason

July 2009

Modified example.

Information enhancement.