<%
'on error resume next
dim str
Const ForReading =1
Const Create =false
Dim Fso
Dim TS
Dim strLine
Dim strFileName
strFileName=server.Mappath("fso.txt")
Set fso=server.createObject("Scripting.FileSystemObject")
Set ts=Fso.OpenTextFIle(strFileName,ForReading,Create)
IF not Ts.AtEndOfStream then
Do while not ts.AtEndOfStream
strLine=Ts.Readline
str=str&","&strLine
'response.write ","
loop
end if
str=mid(str,2)
'response.write str
Ts.close
set ts=nothing
set fs=nothing
'=========================
'str是从文本中读出的数组
'=========================
%>
<%
function dvHTMLEncode(fString,StrWord)
if not isnull(fString) then
' Dim Myvalue
' dim pos 'pos为字符串的位置
' Randomize '初始化随机数生成器。
' Myvalue = Int((6 * Rnd) + 1)' 产生 1 到 6 之间的随机数。
'===================取出数组=============
dim i
if instr(str,",")>0 then
str=split(str,",",-1,1)
Myvalue=Ubound(str)
' for i=0 to Myvalue
' response.write str(i)&"
"
' next
i=0
'=====================End=================
pos=instr(fString,strWord)
if pos>0 then
while Len(fString)>0 and Pos>0
if i>Myvalue then
i=0
end if
response.write left(fString,pos-1)&"
"&str(i)&"
"
fString=mid(fString,pos+1)
pos=inStr(fString,strWord)
' response.write fString
i=i+1
wend
else
response.write fString&"
"&str(0)&""
end if
end if
end if
end function
%>
零刻联盟--asp专区程序设计比赛
<% dim strString strString=trim(request.Form("strString")) call dvHtmlEncode(strString,Chr(10)) %>
|