?? 17-2 fso的“drives”集合.hta
字號(hào):
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=GB2312" />
<title>17-2 FSO的“Drives”集合</title>
<style>
* { font-size:12px; font-family:宋體, Arial; } /*規(guī)定了所有的字體樣式*/
body { overflow:auto; }
table { width:100%; }
a { color:blue; line-height:20px; width:100%; overflow:visible; padding:0px 5px; text-decoration:none; }
a:hover { background-color:#EFEFFF; color:black; }
</style>
<script>
function showDriveList(){
var fso, re, n, e, item;
//創(chuàng)建一個(gè)FSO對(duì)象
fso = new ActiveXObject("Scripting.FileSystemObject");
//將Drives返回的集合轉(zhuǎn)換為枚舉對(duì)象
e = new Enumerator(fso.Drives);
//初始化返回值
re = "";
//開始循環(huán)遍歷每個(gè)Drive對(duì)象
for (; !e.atEnd(); e.moveNext()){
//獲取枚舉集合中的當(dāng)前Drive元素
item = e.item();
//獲取此驅(qū)動(dòng)器的盤符
re += item.DriveLetter;
re += " - ";
//如果此驅(qū)動(dòng)器為共享驅(qū)動(dòng)器
if(item.DriveType == 3){
//獲取其共享名
n = item.ShareName;
}else if(item.IsReady){
//如果驅(qū)動(dòng)器已準(zhǔn)備好
//獲取驅(qū)動(dòng)器的卷名
n = item.VolumeName;
}else{
n = "[驅(qū)動(dòng)器未準(zhǔn)備好]";
}
re += n + "<br>";
}
return(re);
}
document.write(showDriveList());
</script>
</head>
<body>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -