<%
Set rsG = server.CreateObject("adodb.recordset")
sqlG="select * from view_NewsInfo where class=47 and SmallImg<>''"
rsG.Open sqlG, conn, 1, 1
For I=1 To 6 '显示新闻条数
If rsG.Eof Then '是否到纪录尾,是退出循环
Exit For
End If
response.Write("imag["I"]="""&rsG("SmallImg")&""";")
rsG.MoveNext
Next
rsG.Close
Set rsG = Nothing
%>
我想输出这个I,从1到6.我这么写肯定不对,页面报错了,说语法不对。请教高手,我应该怎么得到imag[1]....imag[2]......
------解决方案--------------------
response.Write("imag[" & I & "]="""& ...
------解决方案--------------------
response.Write("imag["I"]="""&rsG("SmallImg")&""";")
是想输出到js里边用的吧,
上边I的左右两边缺了 & 号,你rsG("SmallImg")左右都有 & 啦