moveNext Method

Microsoft Office JScript

Microsoft® JScript® moveNext Method  Language Reference 
Version 3 

See Also                  Applies To


Description
Moves the current item to the next item in the collection.
Syntax
myEnum.moveNext( )

The myEnum argument is any Enumerator object.

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 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);
}