如图
ASP 网页,当该出货单收到钱的时候就点“收款” 的复选框。
在页面不刷新的情况下,如何提交到服务器?
还有,这个页面除了普通的电脑浏览外,还有一个就是经常用手机的安卓系统来浏览该页面。应该没有影响?代码如下<!--#include file="Conn2.asp"--><html>
<head><%function   sumzonger(str)
set rs2=server.CreateObject("adodb.recordset")
rs2.Open "select SUM(zonger) as zonger2 from chuhuo where chuhuodan='" & Replace(str, "'","''") & "'",conn2,1,1
if not rs2.eof then
sumzonger=rs2("zonger2")
else
sumzonger=""end ifrs2.Close
set rs2=nothing
end   functionfunction   getdanwei(str)
set rs2=server.CreateObject("adodb.recordset")
rs2.Open "select danwei from chanpin where _identify="&str,conn2,1,1
if not rs2.eof then
getdanwei=rs2("danwei")
else
getdanwei=""
end ifrs2.Close
set rs2=nothing
end   function%>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="style.css" type=text/css rel=stylesheet><style type="text/css">
<!--
body {
background-color: #ced7f7;
}
.STYLE3 {font-size: 15px}
.STYLE5 {
font-size: 36px;
font-weight: bold;
}
-->
</style></head>
<div align="center"><span class="STYLE5">出货单</span>
  
</div>
<P><table width="562" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
   
    <td width="100" height="22" align="center"><span class="STYLE3">出货日期</span></td>
    <td width="96" align="center">出货单</td>
    <td width="192" height="22" align="center">单位名称</td>
    <td width="91" height="22" align="center">金额</td>
    <td width="71" height="22" align="center">收款</td>
  </tr>
  
  <%
'开始分页
MaxPerPage=30
    dim totalPut   
    dim CurrentPage
    dim TotalPages
    dim j
    dim sql
     if Not isempty(request("page")) then
       currentPage=int(request("page"))
    else
       currentPage=1
    end if

set rs=server.CreateObject("adodb.recordset")
sql="select * from chuhuodan  where _identify>0 "
            
if kehuid<>"" then
 kehuid="kehuid"
 end if

            sql=sql&" order by _identify desc"
            rs.open sql,conn2,1,1


   if rs.eof And rs.bof then
        Response.Write "<p align='center' class='contents'> 对不起,没有找到相关信息!</p>"
    else
   totalPut=rs.recordcount       if currentpage<1 then
           currentpage=1
       end if       if (currentpage-1)*MaxPerPage>totalput then
    if (totalPut mod MaxPerPage)=0 then
      currentpage= totalPut \ MaxPerPage
    else
       currentpage= totalPut \ MaxPerPage + 1
    end if
       end if        if currentPage=1 then
             showContent
             showpage totalput,MaxPerPage,"shoukuan.asp"
        else
           if (currentPage-1)*MaxPerPage<totalPut then
             rs.move  (currentPage-1)*MaxPerPage
             dim book
             book=rs.book
             showContent
              showpage totalput,MaxPerPage,"shoukuan.asp"
         else
         currentPage=1
            showContent
            showpage totalput,MaxPerPage,"shoukuan.asp"
       end if
    end if
        end if    sub showContent
        dim i

    i=0
do while not rs.eof


%>
  <tr>    <td height="22" align="center"><span class="STYLE3"><%=rs("chuhuodate")%></span></td>
    <td align="left"><%=rs("chuhuodan")%></td>
    <td height="22" align="left"><%=rs("kehuname")%></td>
    <td height="22" align="left"><%=sumzonger(rs("chuhuodan"))%></td>
    <td height="22" align="center"><%=rs("wancheng")%><form name="form1" method="post" action=""><input type="checkbox" name="checkbox" value="checkbox"></form>
    </td>
  </tr>
  <%i=i+1
     
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
</table>
<% End Sub   
Function showpage(totalnumber,maxperpage,filename)  
   Dim n
  
If totalnumber Mod maxperpage=0 Then  
n= totalnumber \ maxperpage  
Else
n= totalnumber \ maxperpage+1  
End If

Response.Write "<form method=Post action="&filename&"?selectm="&selectm&"&selectkey="&selectkey&" >"  
Response.Write "<p align='center' class='contents'> "  
If CurrentPage<2 Then  
Response.Write "<font class='contents'>首页 上一页</font> "  
Else  
Response.Write "<a href="&filename&"?page=1&tel="&tel&" class='contents'>首页</a> "  
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&tel="&tel&" class='contents'>上一页</a> "  
End If

If n-currentpage<1 Then  
Response.Write "<font class='contents'>下一页 尾页</font>"  
Else  
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&tel="&tel&" class='contents'>"  
Response.Write "下一页</a> <a href="&filename&"?page="&n&"&tel="&tel&" class='contents'>尾页</a>"  
End If  
Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
Response.Write "<font class='contents'> 共有"&totalnumber&"条记录 " 
Response.Write "<font class='contents'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">"  
Response.Write "&nbsp;<input type='submit'  class='button' value='GO' name='cndok'></form>"  
End Function  
%>
</html>

解决方案 »

  1.   

    用ajax,懒写js代码就用jquery
    save.asp
    <%
    id=request("id")
    '=======根据id更新记录
    response.write "1"
    %>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script>
    function ajaxPost(id){
    $.ajax({
    url:'save.asp',
    data:{id:id},
    type:'POST',
    dataType:'text',
    error:function(xhr){alert('错误\n'+xhr.responseText)},
    success:function(data){if(data=='1')alert('保存成功');else alert('保存失败!\n'+data)}
    })
    }
    </script>
    <form name="form1" method="post" action=""><input type="checkbox" name="checkbox" value="checkbox" onclick="ajaxPost(<%=rs("记录的id字段")%>)"></form>
      

  2.   

    谢谢showbo 版主!
    看到一点希望。可是运行还是不成功。
    行的主字段就是_identify
    代码如下:
    <script>
    function ajaxPost(id){
    $.ajax({
    url:'save.asp',
    data:{id:id},
    type:'POST',
    dataType:'text',
    error:function(xhr){alert('错误\n'+xhr.responseText)},
    success:function(data){if(data=='1')alert('保存成功');else alert('保存失败!\n'+data)}
    })
    }
    </script>
    <form name="form1" method="post" action=""><input type="checkbox" name="checkbox" value="checkbox" onclick="ajaxPost(<%=rs("_identify")%>)"></form>还望指教!
      

  3.   

    另外 
    data:{id:id},
    type:'POST',
    dataType:'text',
    datatype 可不可以用int?
    dataType:'int',
      

  4.   

    删除其他html代码,看我给的示例<%
    id=request("id")
    '=======根据id更新记录
    response.write "1"
    %>
      

  5.   

    还是没弄明白。<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script>
    function ajaxPost(id){
    $.ajax({
    url:'save.asp',
    data:{id:id},
    type:'POST',
    dataType:'text',
    error:function(xhr){alert('错误\n'+xhr.responseText)},
    success:function(data){if(data=='1')alert('保存成功');else alert('保存失败!\n'+data)}
    })
    }
    </script>
    <form name="form1" method="post" action=""><input type="checkbox" name="checkbox" value="checkbox" onclick="ajaxPost(<%=rs("_identify")%>)"></form>
    save.asp 页面
    <!--#include file="conn2.asp"--><%
    id=request("id")
    set rs2=server.CreateObject("adodb.recordset")
    rs2.Open "select * from chuhuodan where _identify='"&id&"'",conn2,1,3
    rs2("wancheng")=0
    rs2.Update
    rs2.movenext
    rs2.Close
    set rs2=nothing
    %>  运行结果
      

  6.   

    楼主怎么就不认真看代码,response.write输出少了<!--#include file="conn2.asp"-->
    <%
    id=request("id")
    set rs2=server.CreateObject("adodb.recordset")
    rs2.Open "select * from chuhuodan where _identify='"&id&"'",conn2,1,3
    rs2("wancheng")=0
    rs2.Update
    rs2.movenext
    rs2.Close
    set rs2=nothingresponse.Clear'清除之前的内容
    response.Write 1
    response.End'禁止输出后面的内容

    %>  
      

  7.   

    弹出窗口太碍事了。可是怎么清除弹出窗口呢?
    删除 success:function(data){if(data=='1')alert('保存成功');else alert('保存失败!\n'+data)} 不行
    删除  {if(data=='1')alert('保存成功');else alert('保存失败!\n'+data)} 也不行。
    删除 save.asp 页面 的 response.Clear'清除之前的内容  response.Write 1  response.End'禁止输出后面的内容  页面也不行
      

  8.   

    想要清除 提示框
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script>
    function ajaxPost(id){
    $.ajax({
    url:'save.asp',
    data:{id:id},
    type:'POST',
    dataType:'text',
    error:function(xhr){alert('错误\n'+xhr.responseText)},
    success:function(data){if(data=='1')alert('保存成功');else alert('保存失败!\n'+data)}
    })
    }这样就成功
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script>
    function ajaxPost(id){
    $.ajax({
    url:'save.asp',
    data:{id:id},
    type:'POST',
    dataType:'text',
    error:function(xhr){alert('错误\n'+xhr.responseText)},
    success:function(data){}
    })
    }
    这样就不成功
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script>
    function ajaxPost(id){
    $.ajax({
    url:'save.asp',
    data:{id:id},
    type:'POST',
    dataType:'text',
    error:function(xhr){alert('错误\n'+xhr.responseText)},
    success:function(data)
    })
    }到底是为什么?
      

  9.   

    楼主去学下js吧。。很基础的东西function ajaxPost(id){
    $.ajax({
    url:'save.asp',
    data:{id:id},
    type:'POST',
    dataType:'text',
    error:function(xhr){alert('错误\n'+xhr.responseText)}
    })
    }
      

  10.   

    原来最后一行不需要逗号。
    谢谢 showbo 版主!我一定要学一下js了。
    可是目前问题没有解决。
    程序已经可以运行了。在一台测试机上是可以运行了。
    可是把程序搬到服务器上就不行了。原因是服务器不能联外网。
    应该是这个东西引起的
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    这是什么东西?类似于驱动吗?服务器不能上外网,可是客户端都可以上外网,客户端加载网页的时候不是把这个也给访问了吗?
    具体什么原因呢?
    如果不行的话看来只能用JavaScript来写了?
      

  11.   

    http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js下载下来,该你的代码为你下载的文件路径就行了。