循环前先定义var show1=""。
解决方案 »
- ckeditor拓展onclick事件问题
- 60秒的倒计时牌怎么弄
- 关于 window.locationbar.visible 在IE下的问题
- ?求助:如何用jsp+javascript制作动态统计图
- 谁有javascript访问Web Services处理XML结果的例子?
- 呼唤wuxinlangman(无心之尘) leohuang(LEO) ,上午的问题没有完全解决
- jquery autocomplate
- 表格显示的问题.用js控制,在线等
- 如何 实现 下载 任何类型文档 (exe \ doc \ ....)
- 菜鸟问题,请您帮忙-关于this的问题(解答给分)
- xml增加一行数据的操作
- 百度 mp3新歌top100里的歌曲文件名是什么编码
<%
sql1="select * from news where nb='20'"
set rs1=conn.execute(sql1)
do while not rs1.eof
%><SCRIPT>
var show1 = '<%=rs1("Title")%> ' + show1;
</SCRIPT><%
rs1.movenext
loop
rs1.close
%><SCRIPT>
document.write(show1);
alert(show1);
</SCRIPT>
我的是这样写的 可是不管怎么改 最后都会多个undefined
要是写成
<SCRIPT>
var show1='';
show1 = '<%=rs1("Title")%> ' + show1;
</SCRIPT>就只返回最后一个值 不过没有undefined了
有没有高手帮帮忙啊
var show1 ="";
</SCRIPT> <%
sql1="select * from news where nb='20'"
set rs1=conn.execute(sql1)
do while not rs1.eof
%> <SCRIPT>
show1 = ' <%=rs1("Title")%> ' + show1;
</SCRIPT> <%
rs1.movenext
loop
rs1.close
%> <SCRIPT>
document.write(show1);
alert(show1);
</SCRIPT>
dim astr:astr=""'js输出变量
'定义数据库 astr=astr&"<div align="center"> <A HREF=about.asp?nb=<%=rs1("nb")%>&id= <%=rs1("id")%>><%=rs1("Title")%></A></div>"'连接所有字符串
rs1.movenext
loop
%>
<SCRIPT>
var show1="<%=astr%>";//这里才赋值
document.write(show1);
</SCRIPT>
dim astr:astr=""'js输出变量
'定义数据库 astr=astr&"<div align='center'><A HREF=about.asp?nb="&rs1("nb")&"&id="&rs1("id")&">"&rs1("Title")&"</A></div>"'连接所有字符串
rs1.movenext
loop
%>
<SCRIPT>
var show1="<%=astr%>";//这里才赋值
document.write(show1);
</SCRIPT>