Enumerator.moveFirst() : Enumerator « MS JScript « JavaScript Tutorial






The moveFirst() method moves the enumerator to the beginning of the collection. If the collection is empty or undefined, undefined is returned.

<html>
    <H1>Drive Letters and drive types:</H1>
    <script language="JScript">
    <!--
    var fileSysObj = new ActiveXObject("Scripting.FileSystemObject");

    var en = new Enumerator(fileSysObj.Drives);

    for (;!en.atEnd();en.moveNext()) {
      document.write("Drive " + en.item().DriveLetter + " is of type " + en.item().DriveType+"<br>");

    }
    document.write("<h1>Drive Status:</h1>");
    en.moveFirst();

    for (;!en.atEnd();en.moveNext()) {
      if(en.item().IsReady) {
        document.write("Drive ",en.item().DriveLetter);
        document.write(" is ready!<br>");
      } else {
        document.write("Drive ",en.item().DriveLetter);
        document.write(" is not ready!<br>");
      }
    }
    -->
    </script>
    </html>








32.7.Enumerator
32.7.1.Enumerator
32.7.2.Enumerator.atEnd()
32.7.3.Enumerator.item()
32.7.4.Enumerator.moveFirst()
32.7.5.Enumerator.moveNext()