循环出错,高手指点下,感激
我在改生成模板程序...有一个奇怪的问题出现在了.我有个下载地址是这样的---下载1|http://@@@下载2|http://2
while not rs_makeview.eof and m_num<100
[color=Red]zt_downurl=rs_makeview("zt_downurl")
if zt_downurl<>"" then:u=zt_downurl:else:u="<p>暂无下载地址,请到下面搜索</p>":end if
downurlstr=u
if InStr(downurlstr,"@@@")>0 then
downurlstr1=Split(downurlstr,"@@@")
for f=0 to Ubound(downurlstr1)
xx=split(downurlstr1(f),"|")
surl="<li><a href="&xx(1)&">"+xx(0)+"</a></li>"
yy=yy&surl
u="<ul>"+yy+"</ul>"
Next
else
if instr(u,"|")>0 then
xx=split(u,"|")
surl="<li><a href="&xx(1)&">"+xx(0)+"</a></li>"
yy=yy&surl
u="<ul>"+yy+"</ul>"
end if
end if[/color] 这是是读取下载地址,进行分离
[color=Lime]html_template = Replace(html_template,"{maxz_downurl}",u)[/color]模板替换
m_num=m_num+1
rs_makeview.MoveNext
Wend
第一次循环没有问题,生成的 下载地址是正确的
第二次循环,就变成了,第一次循环的下载地址+这次循环的地址
第三次,变成上两次地址+这次
......
这是循环哪里有问题,请高手指点,[color=Red]怎么样只要红色的代码循环一次,而不和外面的大循环是第N次的话就循环N次[/color]
[[i] 本帖最后由 aigool 于 2008-7-4 13:43 编辑 [/i]] 都在睡觉吗....
代码的意思也就是
这样
<%
for i=0 to 10
downurlstr="下载1|http://11@@@下载2|http://22"
if InStr(downurlstr,"@@@")>0 then
downurlstr1=Split(downurlstr,"@@@")
for f=0 to Ubound(downurlstr1)
xx=split(downurlstr1(f),"|")
surl="<li><a href="&xx(1)&">"+xx(0)+"</a></li>"
yy=yy&surl
u="<ul>"+yy+"</ul>"
Next
else
if instr(u,"|")>0 then
xx=split(u,"|")
surl="<li><a href="&xx(1)&">"+xx(0)+"</a></li>"
yy=yy&surl
u="<ul>"+yy+"</ul>"
end if
end if
response.write u
next %> 每次循环先将yy变量清空,或者重新申请个变量. 飞哥,谢谢你的指点,感激
循环完定义YY=""就OK了
[[i] 本帖最后由 aigool 于 2008-7-4 14:06 编辑 [/i]]
页:
[1]