javascript:nextAd() 不循环最后一张出现undefined

来源:百度知道 编辑:UC知道 时间:2024/06/07 22:52:25
<%sub showpiclist(Nname,Nnum,Ncount,Nurl,istext,ww,hh)%>
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<%dim tid,i,picrs
i=1
cols=2
set picrs=server.CreateObject("adodb.recordset")
sql="select typeid from type_table where typename='"&Nname&"'"
picrs.open sql,conn,1,3
if picrs.bof and picrs.eof then
else
tid=picrs("typeid")
end if
picrs.close
if Ncount=0 then
sql="select * from pic where topbook<>2 and typeid like '"&tid&"%' and prdpic<>"""" order by id desc"
else
sql="select top "&Ncount&" * from pic where topbook<>2 and typeid like '"&tid&"%' and prdpic<>"""" order by id desc"
end if
picrs.open sql,conn,1,1
while not picrs.eof
%><sc

出现最后一张undefined通常可能是因为运算逻辑错误,对于一个数组的最后一个元素其值应该是数组长度减1,也就是arrayName[arrayName.length-1],如果是arrayName[arrayName.length]的话即会提示undefine,检查一下是不是这个原因