<script>
var i=1;
//列举驱动器
function ShowDriveList(list1)
{
var fso, s, n, e, x,j;
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives);
s = "";
j=1;
for (; !e.atEnd(); e.moveNext())
{
x = e.item();
if (x.IsReady){
s = x.DriveLetter+"://";
j++;
rD(list1,s)
}
}
}
//导入select
function rD(list1,ss){
var oNewNode=document.createElement("<option>");
list1.appendChild(oNewNode);
oNewNode.innerText=ss;
oNewNode.value=i;
i++;
}
//列举文件夹
function ShowFileAccessInfo(list2,filespec)
{
var fso, f,k,k1,pl,pl2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(filespec);
var k=new Enumerator(f.SubFolders);
for (;!k.atEnd();k.moveNext())
{
pl=filespec+k.item().name+"//";
rD(list2,pl);
}
var k1=new Enumerator(f.Files);
for (;!k1.atEnd();k1.moveNext())
{
pl2=filespec+k1.item().name;
rD(list2,pl2);
}
//return(pl);
}
//清空select
function clearselect(sName)
{
if (sName.options.length-1>0){
for(i=sName.options.length-1;i<=0;i--)
{
sName.options.remove[i];
window.status=sName.options.length-1;
}
}
}
</script>
<body>
<select id=oList size=10 style="width:80px;" onclick=ShowFileAccessInfo(oList2,this.options[selectedIndex].text)>
</select>
<select id=oList2 size=30 style="width:200px;" onclick=ShowFileAccessInfo(oList3,this.options[selectedIndex].text)>
</select>
<select id=oList3 size=30 style="width:200px;" onclick="ShowFileAccessInfo(oList4,this.options[selectedIndex].text)">
</select>
<select id=oList4 size=30 style="width:200px;" onclick="ShowFileAccessInfo(oList5,this.options[selectedIndex].text)">
</select>
<select id=oList5 size=30 style="width:200px;" onclick="ShowFileAccessInfo(oList6,this.options[selectedIndex].text)">
</select>
<select id=oList6 size=30 style="width:200px;" onclick="">
</select>
<br>
<input type=button value=" 添加 " onclick="ShowDriveList(oList)">
</body>