一个ASP循环问题

偷麦 2011-11-02 01:31:29
A页面一个文本框 可以输入数字 B页面是处理页面
A提交1 B页面显示 内容1
如果A页面提交2 B页面显示 <div>内容1</div> 内容2
如果A页面提交3 B页面显示 <div>内容1</div> <div>内容2</div> 内容3

就是输入1的时候就直接显示内容 输入比1大的时候 就最后那个不加div 其他的都加
...全文
83 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
偷麦 2011-11-03
  • 打赏
  • 举报
回复
把0改成1就行了 谢谢
偷麦 2011-11-03
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 hefeng_aspnet 的回复:]

action_number=Request.form("action_number")
<%sql="select top "&action_number&" * from lhy_hao where usersname='"&usersname&"' and zhuangtai=1 order by hao_id asc"
rs.open ……
[/Quote]

这个输出的不对啊
kingmeta 2011-11-03
  • 打赏
  • 举报
回复
把改的你的代码,试试

<%sql="select top "&action_number&" * from lhy_hao where usersname='"&usersname&"' and zhuangtai=1 order by hao_id asc"
rs.open sql,conn,1,1
i=1
while not rs.eof

if i<>action_number then
response.write "<div>" & "内容" & i & "</div>"
else
response.write "内容" & i
end if
i=i+1
rs.movenext
wend
rs.close%>
晨晨 2011-11-03
  • 打赏
  • 举报
回复
iInputNum = x;//x为接收的输入,注意类型转换。

for ( i=iInputNum ; i>1; i-- )
{
response.write("<div>内容"+i+"</div>");
}

if ( iInputNum == 1 )
reseponse.write( "内容"+iInputNum +"<BR>");
AW 2011-11-02
  • 打赏
  • 举报
回复



<%
action_number=Request.form("action_number")
sql="select top "&action_number&" * from lhy_hao where usersname='"+usersname+"' and zhuangtai=1 "
rs.open sql,conn,1,1
while not rs.eof
%>
内容

<%
rs.movenext
rs.close
%>


我记得ASP的<%%>好像不是随便位置的
csdn_aspnet 2011-11-02
  • 打赏
  • 举报
回复
action_number=Request.form("action_number")
<%sql="select top "&action_number&" * from lhy_hao where usersname='"&usersname&"' and zhuangtai=1 order by hao_id asc"
rs.open sql,conn,1,1
dim num=0
while not rs.eof
if num<>action_number then
response.write "<div>" & "内容" & i & "</div>"
else
response.write "内容" & i
end if

rs.movenext
num=num+1
wend
rs.close%>
偷麦 2011-11-02
  • 打赏
  • 举报
回复

action_number=Request.form("action_number")
<%sql="select top "&action_number&" * from lhy_hao where usersname='"&usersname&"' and zhuangtai=1 order by hao_id asc"
rs.open sql,conn,1,1
while not rs.eof
%>
内容

<%rs.movenext
wend
rs.close%>


原样是这样的 怎么弄呢 你的是for循环 但是我这个怎么弄
Dogfish 2011-11-02
  • 打赏
  • 举报
回复
n=3
for i=1 to n
if i<>n then
response.write "<div>" & "内容" & i & "</div>"
else
response.write "内容" & i
end if
next

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧