函数里面怎么返回数组,以便后面的程序继续调用?
函数如下:
function splitre(str)
Dim strurl(10000),strtxt(10000),strtim(10000)
str=replace(str,"""","'")
str1=split(str,"<div class='mod newslist'>")
str2=split(str1(1),"</div>")
strx=replace(replace(replace(replace(str2(0),"<ul><li>",""),"<a target='_blank' href='",""),"</ul>",""),"</li>","")
strx=replace(replace(replace(replace(replace(replace(strx,"<li>",""),"<span class='pub_time'>",""),"</span>","|||"),"·",""),"'>","|"),"</a> ","|")
strx=replace(strx," "," ")
strxx=split(strx,"|||")
for i=0 to ubound(strxx)
strtex=split(strxx(i),"|")
if ubound(strtex)>=2 then
strurl(i)=strtex(0)
strtxt(i)=strtex(1)
strtim(i)=strtex(2)
end if
next
end function
我试着调用那数组
for i=0 to ubound(strurl)
if len(strurl(i))<=0 then exit for
response.Write strurl(i)&"<br>"
next
response.Write "<br>文章标题列表:<br>"
for i=0 to ubound(strtxt)
if len(strtxt(i))<=0 then exit for
response.Write strtxt(i)&"<br>"
next
response.Write "<br>时间:<br>"
for i=0 to ubound(strtim)
if len(strtim(i))<=0 then exit for
response.Write strtim(i)&"<br>"
next
报错类型出错
于是我换成
Dim strurl(10000),strtxt(10000),strtim(10000)
function splitre(str)
str=replace(str,"""","'")
str1=split(str,"<div class='mod newslist'>")
str2=split(str1(1),"</div>")
strx=replace(replace(replace(replace(str2(0),"<ul><li>",""),"<a target='_blank' href='",""),"</ul>",""),"</li>","")
strx=replace(replace(replace(replace(replace(replace(strx,"<li>",""),"<span class='pub_time'>",""),"</span>","|||"),"·",""),"'>","|"),"</a> ","|")
strx=replace(strx," "," ")
strxx=split(strx,"|||")
for i=0 to ubound(strxx)
strtex=split(strxx(i),"|")
if ubound(strtex)>=2 then
strurl(i)=strtex(0)
strtxt(i)=strtex(1)
strtim(i)=strtex(2)
end if
next
end function
for i=0 to ubound(strurl)
if len(strurl(i))<=0 then exit for
response.Write strurl(i)&"<br>"
next
response.Write "<br>文章标题列表:<br>"
for i=0 to ubound(strtxt)
if len(strtxt(i))<=0 then exit for
response.Write strtxt(i)&"<br>"
next
response.Write "<br>时间:<br>"
for i=0 to ubound(strtim)
if len(strtim(i))<=0 then exit for
response.Write strtim(i)&"<br>"
next
调试没有内容输出额
数组里面是有内容的
望高人指点指点,谢谢
------解决方案--------------------
友情帮顶