蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年8月25日 8:28

[asp]帮我看看为什么错了,看不懂?还请高手指教!!!

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% response.Expires=0 %>
<!--#include file="conn.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<p>
  <%
dim fullbag,emptybag,action,book_id(10),book_num(10),book_name(10),persum(10),totalsum,book_exisflag

if session("firstselect")=""  then session("firstselect")=true
if session("firstselect")=true  then

for i=0 to 9
book_id(i)=0
book_num(i)=0
persum(i)=0
next
else
for i=0 to 9
book_id(i)=session("book_id")(i)
book_num(i)=session("book_num")(i)
next
end if

for i=0 to 9
if book_id(i)=0 then
fullbag=false
exit for
fullbag=true


action=request.QueryString("action")

select case action

case "selsct"

'说的这行的 循环控制变量 'for' 无效
for i=0 to 9

if book_id(i)=request.querystring("book_id") then
book_num(i)=book_num(i)+1
book_exisflag=true
exit for
end if
next

if book_exisflag<>true then
for i=0 to 9
if book_id(i)=0 then
book_id(i)=request.querystring("book_id")
book_num(i)=1
exit for
end if
next
end if
case "del"
for i=0 to 9
if book_id(i)=request.querystring("book_id") then
book_num(i)=session("book_num")(i)-1
if book_num(i)=0 then book_id(i)=0
end if
next
case "delall"
for i=0 to 9
book_id(i)=0
book_num(i)=0
next
emptybag=true
end select

for i=0 to 9
if book_id(i)<>0 then
emptybag=false
exit for
else
emptybag=true
end if
next

%>
</p>
<form  method="post" action="commpletecorder.asp">
  <p>&nbsp;</p>
  <table width="450" border="0">
    <tr>
      <td colspan="7"><div align="center">书店购物袋</div></td>
    </tr>
    <tr>
      <td colspan="7" bgcolor="#CCCCCC">
            <div align="center">
              <% if emptybag=true then
          response.write "你没有选取书!目前的购物袋为空."
          else
          set rs= Server.CreateObject("adodb.recordset")
       
           %>
      &nbsp;</div></td>
    </tr>
    <tr>
      <td colspan="7" bgcolor="#CCCCCC">
          <% if fullbag=true then response.write"你只能选取10种书,目前购书袋已汇满." %>&nbsp;</td>
    </tr>
    <tr>
      <td width="36" bgcolor="#FFFFCC"><div align="center">编号</div></td>
      <td width="100" bgcolor="#FFFFCC"><div align="center">书名</div></td>
      <td width="40" bgcolor="#FFFFCC"><div align="center">单价</div></td>
      <td width="46" bgcolor="#FFFFCC"><div align="center">数量</div></td>
      <td width="52" bgcolor="#FFFFCC"><div align="center">总价</div></td>
      <td width="83" bgcolor="#FFFFCC"><div align="center">图书类型</div></td>
      <td width="63" bgcolor="#FFFFCC"><div align="center">删除一本</div></td>
    </tr>
   <%
        total=0
        for i=0 to 9
        if book_id(i)<>0 then
        sql="select book_name,price,types,dates from book where book_id="&book_id(i)
        rs.open sql,conn,3
        if not rs.eof then
        book_name(i)=rs("book_name")
        persum(i)=rs("price")*book_num(i)
        total=total+persum(i)
        %> <tr>
      <td bgcolor="#FFFFCC"><%= book_id(i) %>&nbsp;</td>
      <td bgcolor="#FFFFCC"><%= rs("book_name")%></td>
      <td bgcolor="#FFFFCC"><%= rs("price")%></td>
      <td bgcolor="#FFFFCC"><%= book_num(i)%></td>
      <td bgcolor="#FFFFCC"><%= persum(i)%></td>
      <td bgcolor="#FFFFCC"><%= rs("types")%></td>
      <td bgcolor="#FFFFCC"><a href="bookbag.asp?action=del&amp;book_id=<%= book_id(i) %>">删除一本</a></td>
    </tr><% end if
        rs.close
        next %>
       
  </table>
  <p><%= total %></p>
  <table width="451" border="0">
    <tr>
      <td width="63">用户号码:</td>
      <td width="168"><input type="text" name="customer_id" /></td>
      <td width="34">密码:</td>
      <td width="168"><input type="password" name="password" /></td>
    </tr>
  </table>
  <p>
    <input type="submit" name="Submit" value="立即定购" />
    <input type="submit" name="Submit2" value="全部清除" on click="top.location.href='bookbag.asp?action=delall'" />
  </p>
  <p>
  <%
  set rs=nothing
  end if
  %></p>
  <%
  session("book_id")=book_id
  session("book_num")=book_num
  session("book_name")=book_name
  session("firstselect")=false
  cn.close
  session("total")=total
  %>
</form>

<p>&nbsp;</p>
</body>
</html>
循环控制变量 'for' 无效,我已经在源码中标出,谢谢.

真多的For循环。。。
看一下for与next是不是一一对应的。。




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com