Applies to: Enumerator Object
Moves the current item to the next item in the collection.
Syntax
myEnum.moveNext( )
The myEnum argument is any Enumerator object.
Return
Returns the next item in the collection.
Example
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:
<HTML> <HEAD> <SCRIPT LANGUAGE= JavaScript> 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); } </SCRIPT> </HEAD> <BODY> <SCRIPT LANGUAGE= JavaScript> document.write(ShowDriveList()); </SCRIPT> </BODY> </HTML>
|
To run the code above, paste it into JavaScript Editor, and go to View, Internal Page Viewer or press F5.
See also: atEnd Method, tem Method, moveFirst Method |