|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
想法是和程序员的想法不一样的.至于为什么.大家去想一想.跟心理学有关的解答|成绩1.分类:语法使用
成绩形貌:查找两个字符串间的字符呈现次数
办理举措:
functionFindStringTimes(strContent,start_string,end_string)start_string与end_string之间字符出次的数
writtenbyJaron
FindStringTimes=ubound(split(strContent,start_string))
endfunction
示例:查找以下字符串有几张图片
response.writeFindStringTimes(HTML,"<imgsrc=http://www.163design.net/a/q/"c.jpg">
2.遍历目次和目次下文件的函数
<%
functionbianli(path)
setfso=server.CreateObject("scripting.filesystemobject")
onerrorresumenext
setobjFolder=fso.GetFolder(path)
setobjSubFolders=objFolder.Subfolders
foreachobjSubFolderinobjSubFolders
nowpath=path+""+objSubFolder.name
Response.Writenowpath
setobjFiles=objSubFolder.Files
foreachobjFileinobjFiles
Response.Write"<br/>---"
Response.WriteobjFile.name
next
Response.Write"<p>"
bianli(nowpath)递回
next
setobjFolder=nothing
setobjSubFolders=nothing
setfso=nothing
endfunction
%>
<%
bianli("d:")遍历d:盘
%>
3.天生一个不反复的随即数字
SubCalCaPiao()
DimstrCaiPiaoNoArr()AsString
DimstrSQLAsString
DimstrCaiPiaoNoAsString
strCaiPiaoNo="01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33"
DimStrTempArr(7)AsString
DimstrZhongJiangArr(7)AsString
strCaiPiaoNoArr=Split(strCaiPiaoNo,",")
DimintRandAsInteger
DimiAsInteger
DimjAsInteger
i=0
DimfindAsBoolean
DoWhileTrue
find=False
Randomize
intRand=Int((33*Rnd)+1)
Forj=0Toi-1
IfStrTempArr(j)=CStr(intRand)Then
find=True
EndIf
Next
IfNotfindThen
StrTempArr(j)=CStr(intRand)
strZhongJiangArr(i)=CStr(intRand)
Text1(i)=strZhongJiangArr(i)
i=i+1
Ifi=7Then
ExitDo
EndIf
EndIf
Loop
EndSub
4.下载任何文件(特别是IE联系关系翻开的)
<%
DimStream
DimContents
DimFileName
DimFileExt
ConstadTypeBinary=1
FileName=Request.QueryString("FileName")
ifFileName=""Then
Response.Write"有效文件名."
Response.End
Endif
上面是不但愿下载的文件
FileExt=Mid(FileName,InStrRev(FileName,".")+1)
SelectCaseUCase(FileExt)
Case"ASP","ASA","ASPX","ASAX","MDB"
Response.Write"受回护文件,不克不及下载."
Response.End
EndSelect
下载这个文件
Response.Clear
Response.ContentType="application/octet-stream"
Response.AddHeader"content-disposition","attachment;filename="&FileName
SetStream=server.CreateObject("ADODB.Stream")
Stream.Type=adTypeBinary
Stream.Open
Stream.LoadFromFileServer.MapPath(FileName)
WhileNotStream.EOS
Response.BinaryWriteStream.Read(1024*64)
Wend
Stream.Close
SetStream=Nothing
Response.Flush
Response.End
%>
5.背景致变更
<form>
<p><inputTYPE="button"value="背景致变更"onClick="BgButton()"></p>
</form>
<script>functionBgButton(){
if(document.bgColor==#00ffff)
{document.bgColor=#ffffff;}
else{document.bgColor=#00ffff;}
}
</script>
6.点击翻开新窗口
<form>
<p><inputTYPE="button"value="翻开新窗口"onCLICK="NewWindow()"></p>
</form>
<scriptlanguage="javascript"><!--
functionNewWindow(){window.open("http://www.mcmx.com";;;,"","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");}
//--></script></body>
7.分页代码:
<%本程叙文件名为:Pages.asp%>
<%包括ADO常量表文件adovbs.inc,可从"ProgramFilesCommonFilesSystemADO"目次下拷贝%>
<!--#IncludeFile="adovbs.inc"-->
<%*创建数据库毗连,这里是Oracle8.05数据库
Setconn=Server.CreateObject("ADODB.Connection")
conn.Open"Prov</p>ASP最大的缺点在于网络的安全性和可靠性,企业将经营数据放在开放的平台上,最大的担忧就是如何保证这些数据不被其他人破坏。 |
|