泪中求ASP函数用法

SubWIZARD2SAVE'response.AddHeader"Content-Type","text/plain"DimMOL,txt:SETMOL=Object(... Sub WIZARD2SAVE
'response.AddHeader "Content-Type","text/plain"
Dim MOL,txt:SET MOL=Object()
Dim bHas:bHas = Array("autocls","reverse","isspecialmlink","splay","isspecial","getpart")
Dim iHas:iHas = Array("into","pageset","classid","istart","iend","picmode","playgetsrc","getherday")
Dim rCrlf:rCrlf = Array("pageurl2","listA","listB","mlinkA","mlinkB","mlinkRF","mlinkRR","nameA","nameB","picvar","plistA","plistB","playlinkA","playlinkB","linkRF","linkRR","msrcA","msrcB","partA","partB")
Dim tHas:tHas = Array("itemname","siteurl","charset","playfrom","pageurl0","pageurl1")
Dim i,t:t=split(trimall(request.Form("fields")),",")
For i=0 to UBound(t):Push rCrlf,t(i)&"A":Push rCrlf,t(i)&"B":Next
For i=0 to UBound(bHas):MOL(bHas(i))=ifthen(request.Form(bHas(i))="1",true,false):Next
For i=0 to UBound(iHas):MOL(iHas(i))=Str2Num(request.Form(iHas(i))):Next
For i=0 to UBound(rCrlf):MOL(rCrlf(i))=DeCrlf(request.Form(rCrlf(i))):Next
For i=0 to UBound(tHas):MOL(tHas(i))=trim(request.Form(tHas(i))):Next
MOL("pageurl2")=DeCrlf(trim(request.Form("pageurl2")))
MOL("removecode")=replace(trimAll(request.Form("removecode")),",","|"):txt=Json.var2json(MOL):SET MOL=Nothing

Dim Path,cPath,filename,referer:filename=getForm("filename","post"):Path=ENGINEDIR&ESCDIR:referer=getForm("referer","post")
if not isExistFile(Path&filename) then
filename=getTimeFileName(".txt")
end if
cPath=ENGINEDIR&ESCACHEDIR&filename
if isExistFile(cPath&".json") then:delFile cPath&".json":end if
if isExistFile(cPath&".tmp") then:delFile cPath&".tmp":end if
if cacheStart=1 then:cacheObj.clearCache("json://"&ESCDIR&filename):end if
CreateTextFile txt,Path&filename,"gb2312"
die "<script type=""text/javascript"">if(confirm('保存成功,是否自动跳转到预览界面?\n\n点[确定]跳转预览界面,[取消]返回项目列表')){self.location.href='?action=demo&filename="&filename&"&result="&Server.URLEncode(referer)&"';}else{self.location.href='?ChildDir="&StrSliceB(filename,"","/")&"';}</script>"
End Sub
请给一步步分析一下好
展开
 我来答
loveid
2011-03-20 · TA获得超过358个赞
知道小有建树答主
回答量:447
采纳率:100%
帮助的人:517万
展开全部
这个例子没必要一步步分析,没什么意义。
ASP的函数大概分为function函数 sub函数
function函数是具有返回值的,sub函数则是直接显示内容的。

给你写几个例子,你一看就懂了。
sub aa
response.write "aaa"
end sub
call aa

sub bb(text) '我是带参数的sub函数
if text<>"" then
response.write "参数是"&text&"<br />"
else
response.write "参数是为里面的程序计算所提供的。<br />"
end if
end sub
chanshu = "abcde"
call bb(chanshu)

sub函数的标准调用写法是call 函数名,call是可以省略的。
直接bb(chanshu)效果等同于call bb(chanshu),不过建议标准写法,让人看着清晰。

function aa
aa = "te1st"
end function
response.write aa
因为function是有返回值的所以如果需要输出需要使用response.write

function aa(text)
aa = "运算结果是:"&text
end function
response.write aa(3+1)

以上就是简单使用方法了,把上面的看明白了,你的sub也看明白了,打字好辛苦
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式