三個函數-數組賦值-下拉式清單輸出-取磁碟機

來源:互聯網
上載者:User
函數|磁碟機|數組|下拉|下拉式清單|函數|磁碟機|數組|下拉|下拉式清單 <TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style>
body{text-align:left;font:12px #000080 ;}
#main{float:left;width:680px;border:#0000ff 1px solid;margin:5px 20px;padding:10px 100px;}
#main p{}
</style>

</HEAD>

<BODY>
<div id="main">
<%
'Option Explicit
select case request("actionname")
case "尋找"
call find(request("dirname"))
case "進入"
call enterdir(request("dirname"))
case otherwise
call showmain()
end select

actionarray=storearrayvalue("尋找,搜尋,走吧,進入",",")
drvname=split(showdrivelist,",")
response.write "<form name=drv action=find.asp>"
response.write writeselect(actionarray,actionname)
response.write writeselect(drvname,dirname)
response.write "<input type=submit name=action value=開始></form>"

'此函數用來給數組賦值,arrayvalue為要賦的字串值,splitmethod為分割此字串的依據

Function storearrayvalue(arrayvalue,splitmethod)
storearrayvalue=split(arrayvalue,splitmethod)
End function

'此函數返回下拉式清單字串,arrayname為傳入的數組名稱,sltname為此下拉式清單的名稱

Function writeselect(arrayname,sltname)
dim slt,i
slt="<select name=" & sltname & ">"
for i=0 to ubound(arrayname)
slt=slt & "<option value=" & arrayname(i) &">" & arrayname(i) & "</option>"
next
slt=slt & "</select>"
writeselect=slt
End function

'此函數返回所有磁碟機

Function ShowDriveList
Dim fso, d, dc,i,s
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
i=0
For Each d in dc
s=s&d.driveletter&","
i=i+1
Next
s=mid(s,1,len(s)-1)
showdrivelist=s
End Function

'此過程輸出所選磁碟機的容量狀況.
showdriveinfo("e:\")
Sub ShowDriveInfo(drvPath)
Dim fso, drv, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set drv = fso.GetDrive(fso.GetDriveName(drvPath))
s = "Drive " & UCase(drvPath) & " - "
s = s & drv.VolumeName & "<br/>"
s = s & "Total Space: " & FormatNumber(drv.TotalSize / (1024*1024*1024), -1)
s = s & " GB" & "<br/>"
s = s & "Free Space: " & FormatNumber(drv.FreeSpace / (1024*1024*1024), -1)
s = s & " GB" & "<br/>"
Response.Write s
End Sub

%>
</div>
</body>
</html>




相關文章

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

Starter Package

SSD Cloud server and data transfer for only $2.50 a month

Get Started >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。