日韩欧美人妻无码精品白浆,www.大香蕉久久网,狠狠的日狠狠的操,日本好好热在线观看

LOGO OA教程 ERP教程 模切知識(shí)交流 PMS教程 CRM教程 開(kāi)發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

通過(guò)數(shù)組給您的文件排序

admin
2010年7月8日 1:5 本文熱度 6592
[p]當(dāng)您使用filesystemobject對(duì)象獲得某個(gè)目錄下的文件列表的時(shí)候,你有沒(méi)有發(fā)現(xiàn)無(wú)法控制它們的排序方式,比如按照名字排序,按照擴(kuò)展名排序,按照文件大小排序等等,讓我們?cè)囍脭?shù)組給它們排排序兒。[br]如果您想通過(guò)名字排序,那將是非常簡(jiǎn)單的,但是假如你想通過(guò)文件大小或者文件創(chuàng)立時(shí)間等等來(lái)排序的時(shí)候,那么將有點(diǎn)麻煩。我們將通過(guò)二維數(shù)組做到這一點(diǎn)。[br]下面的代碼演示了如何通過(guò)選擇排序方式達(dá)到的我們目的,單擊排序,點(diǎn)兩次就反著排了。[/p]
[p][br][br]文件排序演示[br][/p]
[p][/p]
[p]<%[br]' 設(shè)定一個(gè)演示目錄,:)[/p]
[p]const directory = "/" [/p]
[p]' 用常數(shù)定義排序方式[br]const file_name = 0 '按照名字排序……依次類推[br]const file_ext = 1[br]const file_type = 2[br]const file_size = 3[br]const file_created = 4[br]const file_modified = 5[br]const file_accessed = 6[/p]
[p]'獲得 排序命令,默認(rèn)為按照名字排序[/p]
[p]req = request("sortby")[br]if len(req) < 1 then sortby = 0 else sortby = cint(req)[br]req = request("priorsort")[br]if len(req) < 1 then priorsort = -1 else priorsort = cint(req)[/p]
[p]'設(shè)置倒序[br]if sortby = priorsort then[br]reverse = true[br]priorsort = -1[br]else[br]reverse = false[br]priorsort = sortby[br]end if[/p]
[p]' 接下來(lái)開(kāi)始我們真正的代碼了。。。[/p]
[p]path = server.mappath( directory )[/p]
[p]set fso = createobject("scripting.filesystemobject")[br]set thecurrentfolder = fso.getfolder( path ) [br]set curfiles = thecurrentfolder.files [/p]
[p]' 給這些文件做一個(gè)循環(huán)[/p]
[p]dim thefiles( )[br]redim thefiles( 500 ) ' 我隨便定的一個(gè)大小[br]currentslot = -1 ' start before first slot[/p]
[p]' 我們將文件的所有相關(guān)信息放到數(shù)組里面[/p]
[p]for each fileitem in curfiles[br]fname = fileitem.name[br]fext = instrrev( fname, "." )[br]if fext < 1 then fext = "" else fext = mid(fname,fext+1)[br]ftype = fileitem.type[br]fsize = fileitem.size[br]fcreate = fileitem.datecreated[br]fmod = fileitem.datelastmodified[br]faccess = fileitem.datelastaccessed[br]currentslot = currentslot + 1[br]if currentslot > ubound( thefiles ) then[br]redim preserve thefiles( currentslot + 99 )[br]end if[br]' 放到數(shù)組里[br]thefiles(currentslot) = array(fname,fext,ftype,fsize,fcreate,fmod,faccess)[br]next[/p]
[p]' 現(xiàn)在都在數(shù)組里了,開(kāi)始下一步[/p]
[p][br]filecount = currentslot ' 文件數(shù)量[br]redim preserve thefiles( currentslot ) [/p]
[p]' 排序[br]' (8 表示 string)[/p]
[p]if vartype( thefiles( 0 )( sortby ) ) = 8 then [br]if reverse then kind = 1 else kind = 2 ' 給字符排序[br]else[br]if reverse then kind = 3 else kind = 4 '數(shù)字、時(shí)間。。。[br]end if[/p]
[p]for i = filecount to 0 step -1[br]minmax = thefiles( 0 )( sortby )[br]minmaxslot = 0[br]for j = 1 to i[br]select case kind [br]case 1 [br]mark = (strcomp( thefiles(j)(sortby), minmax, vbtextcompare ) < 0)[br]case 2 [br]mark = (strcomp( thefiles(j)(sortby), minmax, vbtextcompare ) > 0)[br]case 3 [br]mark = (thefiles( j )( sortby ) < minmax)[br]case 4 [br]mark = (thefiles( j )( sortby ) > minmax)[br]end select[br]if mark then [br]minmax = thefiles( j )( sortby )[br]minmaxslot = j[br]end if[br]next[/p]
[p]if minmaxslot <> i then [/p]
[p]temp = thefiles( minmaxslot )[br]thefiles( minmaxslot ) = thefiles( i )[br]thefiles( i ) = temp[br]end if[br]next[br]' 結(jié)束[/p]
[p]%>[br]
[br][br][br]
[/p]
[p][/p]
[p]
[br][br]顯示<% = (filecount+1) %> 該目錄下的文件<% = path %>[br][br]

[br]單擊排序,再點(diǎn)一次反向排序[br]

[br][br][br][br][br][br][br][br][br][br][br]<%[/p]
[p]for i = 0 to filecount[br]response.write "" & vbnewline[br]for j = 0 to ubound( thefiles(i) )[br]response.write " " & vbnewline[br]next[br]response.write "" & vbnewline[br]next[br]%>[br]
文件名擴(kuò)展名類型大小建立時(shí)間上次修改時(shí)間上次存取時(shí)間
" & thefiles(i)(j) & "
[/p]
[p][br] [/p]


該文章在 2010/7/8 1:05:55 編輯過(guò)
關(guān)鍵字查詢
相關(guān)文章
正在查詢...
點(diǎn)晴ERP是一款針對(duì)中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國(guó)內(nèi)大量中小企業(yè)的青睞。
點(diǎn)晴PMS碼頭管理系統(tǒng)主要針對(duì)港口碼頭集裝箱與散貨日常運(yùn)作、調(diào)度、堆場(chǎng)、車隊(duì)、財(cái)務(wù)費(fèi)用、相關(guān)報(bào)表等業(yè)務(wù)管理,結(jié)合碼頭的業(yè)務(wù)特點(diǎn),圍繞調(diào)度、堆場(chǎng)作業(yè)而開(kāi)發(fā)的。集技術(shù)的先進(jìn)性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點(diǎn)晴WMS倉(cāng)儲(chǔ)管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購(gòu)管理,倉(cāng)儲(chǔ)管理,倉(cāng)庫(kù)管理,保質(zhì)期管理,貨位管理,庫(kù)位管理,生產(chǎn)管理,WMS管理系統(tǒng),標(biāo)簽打印,條形碼,二維碼管理,批號(hào)管理軟件。
點(diǎn)晴免費(fèi)OA是一款軟件和通用服務(wù)都免費(fèi),不限功能、不限時(shí)間、不限用戶的免費(fèi)OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved

在线成人avv| 色综合五月天激情| 先锋中文字幕在线二区| 日韩av中文字幕一区二区三区| 国产一区和欧美二区| 91亚洲欧美日韩三级成人| 亚洲日韩人妻一区| 亚洲黄色今| 久久国产微精品| 欧美+亚洲+日韩+中文| 人妖操人妖亚洲无码久久久| av高清无码观看网址| 国产精选无码AV| 久碰97| 三级酒色婷婷| av男人天堂丰臀肥乳| a√最新资源天堂在线| 激情电影激情电影三区| 久久这里有精品区12| JULIA隔壁人妻欲求不满| 熟妇五月天免费| 操逼动做视频| 一二区xxxx| 综合二区日本精品| 久久久久亚洲日韩高清| 高清一区二区机械公司| 久久亚洲AV日韩AV无| 天天干天天干天天操天天谢| 久久综合网麻豆视频| 美女骚穴的免费视频软件| 久久情久久| 久久久久不久久精品三级片| 亚州无码图片区视频区| 人妻后入大| 日本欧韩久久久| 婷婷第10色| 日韩高清无码中文字幕不卡| 爆操美女小骚逼逼逼逼网| 久久aV无码精品人妻| 大吊欧美视频| 天天日天天射夜夜操|