absolute;top:
50;width:
200px;height:
115px;z-index:
1">
15.动网FLASH广告代码:
16.VBS弹出窗口小代码:
msgbox"你还没有注册或登陆论坛","0","精品论坛"
location.href="login.asp"
16.使用FSO修改文件特定内容的函数
functionFSOchange(filename,Target,String)
DimobjFSO,objCountFile,FiletempData
SetobjFSO=Server.CreateObject("Scripting.FileSystemObject")
SetobjCountFile=objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FiletempData=objCountFile.ReadAll
objCountFile.Close
FiletempData=Replace(FiletempData,Target,String)
SetobjCountFile=objFSO.CreateTextFile(Server.MapPath(filename),True)
objCountFile.WriteFiletempData
objCountFile.Close
SetobjCountFile=Nothing
SetobjFSO=Nothing
EndFunction
17.使用FSO读取文件内容的函数
functionFSOFileRead(filename)
DimobjFSO,objCountFile,FiletempData
SetobjFSO=Server.CreateObject("Scripting.FileSystemObject")
SetobjCountFile=objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FSOFileRead=objCountFile.ReadAll
objCountFile.Close
SetobjCountFile=Nothing
SetobjFSO=Nothing
EndFunction
18.使用FSO读取文件某一行的函数
functionFSOlinedit(filename,lineNum)
iflinenum<1thenexitfunction
dimfso,f,temparray,tempcnt
setfso=server.CreateObject("scripting.filesystemobject")
ifnotfso.fileExists(server.mappath(filename))thenexitfunction
setf=fso.opentextfile(server.mappath(filename),1)
ifnotf.AtEndofStreamthen
tempcnt=f.readall
f.close
setf=nothing
temparray=split(tempcnt,chr(13)&chr(10))
iflineNum>ubound(temparray)+1then
exitfunction
else
FSOlinedit=temparray(lineNum-1)
endif
endif
endfunction
19.使用FSO写文件某一行的函数
functionFSOlinewrite(filename,lineNum,Linecontent)
iflinenum<1thenexitfunction
dimfso,f,temparray,tempCnt
setfso=server.CreateObject("scripting.filesystemobject")
ifnotfso.fileExists(server.mappath(filename))thenexitfunction
setf=fso.opentextfile(server.mappath(filename),1)
ifnotf.AtEndofStreamthen
tempcnt=f.readall
f.close
temparray=split(tempcnt,chr(13)&chr(10))
iflineNum>ubound(temparray)+1then
exitfunction
else
temparray(lineNum-1)=lineContent
endif
tempcnt=join(temparray,chr(13)&chr(10))
setf=fso.createtextfile(server.mappath(filename),true)
f.writetempcnt
endif
f.close
setf=nothing
endfunction
20.使用FSO添加文件新行的函数
functionFSOappline(filename,Linecontent)
dimfso,f
setfso=server.CreateObject("scripting.filesystemobject")
ifnotfso.fileExists(server.mappath(filename))thenexitfunction
setf=fso.opentextfile(server.mappath(filename),8,1)
f.writechr(13)&chr(10)&Linecontent
f.close
setf=nothing
endfunction
21.读文件最后一行的函数
functionFSOlastline(filename)
dimfso,f,temparray,tempcnt
setfso=server.CreateObject("scripting.filesystemobject")
ifnotfso.fileExists(server.mappath(filename))thenexitfunction
setf=fso.opentextfile(server.mappath(filename),1)
ifnotf.AtEndofStreamthen
tempcnt=f.readall
f.close
setf=nothing
temparray=split(tempcnt,chr(13)&chr(10))
FSOlastline=temparray(ubound(temparray))
endif
endfunction
利用FSO取得BMP,JPG,PNG,GIF文件信息(大小,宽、高等)
<%
':
:
:
BMP,GIF,JPGandPNG:
:
:
':
:
:
Thisfunctiongetsaspecifiednumberofbytesfromany:
:
:
':
:
:
file,startingattheoffset(base1):
:
:
':
:
:
:
:
:
':
:
:
Passed:
:
:
:
':
:
:
flnm=>Filespecoffiletoread:
:
:
':
:
:
offset=>Offsetatwhichtostartreading:
:
:
':
:
:
bytes=>Howmanybytestoread:
:
:
':
:
:
:
:
:
':
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
functionGetBytes(flnm,offset,bytes)
DimobjFSO
DimobjFTemp
DimobjTextStream
DimlngSize
onerrorresumenext
SetobjFSO=CreateObject("Scripting.FileSystemObject")
'First,wegetthefilesize
SetobjFTemp=objFSO.GetFile(flnm)
lngSize=objFTemp.Size
setobjFTemp=nothing
fsoForReading=1
SetobjTextStream=objFSO.OpenTextFile(flnm,fsoForReading)
ifoffset>0then
strBuff=objTextStream.Read(offset-1)
endif
ifbytes=-1then'GetAll!
GetBytes=objTextStream.Read(lngSize)'ReadAll
else
GetBytes=objTextStream.Read(bytes)
endif
objTextStream.Close
setobjTextStream=nothing
setobjFSO=nothing
endfunction
':
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
':
:
:
:
:
:
':
:
:
Functionstoconverttwobytestoanumericv alue(long):
:
:
':
:
:
(bothlittle-endianandbig-endian):
:
:
':
:
:
:
:
:
':
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
functionlngConvert(strTemp)
lngConvert=clng(asc(left(strTemp,1))+((asc(right(strTemp,1))*256)))
endfunction
functionlngConvert2(strTemp)
lngConvert2=clng(asc(right(strTemp,1))+((asc(left(strTemp,1))*256)))
endfunction
':
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
':
:
:
:
:
:
':
:
:
Thisfunctiondoesmostoftherealwork.Itwillattempt:
:
:
':
:
:
toreadanyfile,regardlessoftheextension,andwill:
:
:
':
:
:
identifyifitisagraphicalimage.:
:
:
':
:
:
:
:
:
':
:
:
Passed:
:
:
:
':
:
:
flnm=>Filespecoffiletoread:
:
:
':
:
:
width=>widthofimage:
:
:
':
:
:
height=>heightofimage:
:
:
':
:
:
depth=>colordepth(innumberofcolors):
:
:
':
:
:
strImageType=>typeofimage(e.g.GIF,BMP,etc.):
:
:
':
:
:
:
:
:
':
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
functiongfxSpex(flnm,width,height,depth,strImageType)
dimstrPNG
dimstrGIF
dimstrBMP
dimstrType
strType=""
strImageType="(unknown)"
gfxSpex=False
strPNG=chr(137)&chr(80)&chr(78)
strGIF="GIF"
strBMP=chr(66)&chr(77)
strType=GetBytes(flnm,0,3)
ifstrType=strGIFthen'isGIF
strImageType="GIF"
Width=lngConvert(GetBytes(flnm,7,2))
Height=lngConvert(GetBytes(flnm,9,2))
Depth=2^((asc(GetBytes(flnm,11,1))and7)+1)
gfxSpex=True
elseifleft(strType,2)=strBMPthen'isBMP
strImageType="BMP"
Width=lngConvert(GetBytes(flnm,19,2))
Height=lngConvert(GetBytes(flnm,23,2))
Depth=2^(asc(GetBytes(flnm,29,1)))
gfxSpex=True
elseifstrType=strPNGthen'IsPNG
strImageType="PNG"
Width=lngConvert2(GetBytes(flnm,19,2))
Height=lngConvert2(GetBytes(flnm,23,2))
Depth=getBytes(flnm,
展开阅读全文
相关搜索