<SELECT size=2 id=select1 name=select1 onclick="updateDatabase(this.value,select1.options[select1.selectedIndex].outerText)" style="WIDTH: 261px; HEIGHT: 224px">
<OPTION value="1">3</OPTION>
<OPTION value="2">4</OPTION>
<OPTION value="3">5</OPTION></SELECT>
<SCRIPT LANGUAGE=javascript>
<!--
function updateDatabase(hId,hValue)
{
window.showModalDialog("updateDatabase.asp?hId=" + hId + "&hValue=" + hValue,"newwindow","dialogWidth:1px;dialogHeight:1px;dialogLeft:1px;dialogTop:1px");
}
//-->
</SCRIPT>

解决方案 »

  1.   

    然后在updateDatabase.asp中写好更新的SQL语句就行了。
      

  2.   

    <form name = modify >
      <table border="0" width="776" cellspacing="0" cellpadding="0" height="115">
        <tr>
          <td width="100%" bgcolor="#FCF6E5" height="1" valign="top" style="padding-left: 50; padding-top: 0">
            <p align="left"><img border="0" src="image/tb1.gif" width="100" height="28"></td>
        </tr>
        <center>
        <tr>
          <td width="100%" bgcolor="#FFFFFF" height="137" valign="top" style="padding-top: 0">
            <table border="0" width="100%" cellspacing="0" cellpadding="0" height="190">
              <tr>
                <td width="7%" bgcolor="#FDFAEE" height="37" valign="top"><img border="0" src="image/xx.htm1.gif" width="182" height="67"></td>
                <td width="91%" height="190" valign="top" rowspan="2">
            <div align="center">                              
                 <%     
                 dim leibie
                 dim rs  
                 dim pagecount             
         leibie=request.querystring("lb")  
         keyword=request.querystring("key")
         set rs=server.createobject("adodb.recordset") 
        if leibie="" then 
        rs.open "select * from ysfw where bz='1'",conn,1,1
     else
        rs.open "select * from ysfw where bz='1' and district like '%"&leibie&"%' and name like '%"&keyword&"%' order by district",conn,1,1 
     end if                               
                     if rs.eof and rs.bof then
                %>
                <table border="1" width="96%" bordercolor="#000000" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
                <tr>
                  <td width="10%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#F8EBC2"> 公司资料列表</td>              
                </tr>
                <tr>
                  <td width="10%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"> 暂时还没有需要修改的资料</td>              
                </tr>
       </table>
                <%
                else
    rs.pagesize=6
    pagecount = rs.pagecount
    page =request.querystring("page")
     if (page <> "") then
                       if (isnumeric(page)) then
                          page = clng(page)
                        else
                          page = 1 
                       end if
                     else
                       page = 1
                     end if
    if page<1 then page=1
    if page>rs.pagecount then page=rs.pagecount
    rs.absolutepage=page         
       %>

              <table border="1" width="96%" bordercolor="#000000" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
                <tr>
               
                 
      <td width="2%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2"> 选
                  &nbsp;</td>   
                  <td width="10%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2" >区&nbsp;&nbsp;  
                    名</td>
                  <td width="20%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2">名&nbsp;  
                    称</td>
                  <td width="20%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2">服务&nbsp;  
                    内容</td>  
                  <td width="30%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2">地址</td>              
                  <td width="18%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2">电&nbsp;  
                    话</td>
                    
                </tr> 
                <%for i=1 to rs.pagesize%>
                <tr  bgcolor="#99ccff" >   
                 <td width="2%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#FDFAEE"><input  name="seleon"  type=checkbox  value=<%=rs("id")%> ></td>         
                 <td width="10%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text  id="district" name="district" value=<%=rs("district")%> ></td>
                 <td width="20%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text name=nam value=<%=rs("name")%>"></a></td>
                  <td width="20%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text name=content value=<%=rs("content")%>></td> 
                 <td width="30%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text name=address value=<%=rs("address")%>></td>
                 <td width="18%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text name=phone value=<%=rs("phone")%>></td>             
                
                </tr>
            <%
              rs.movenext 
              if rs.eof then exit for
               next                                           
            %>
             </table>   
             <input type=button onclick="modi()" value="修改">&nbsp;&nbsp;<input type=button onclick="dele()" value="删除">
        </form> 
    我现在不知道怎么写MODI(),和dele()函数,请帮忙看看!!!
      

  3.   

    在循环数据的时候把每条记录的数据隐藏起来
    例如如
    <%for i=0 to 5 
    id = rs.(..)..
    %>
    <input type="checkbox" value="<%=id%>" name="checkFlag">
    <input type="hidden" value="<%=modiValue%>" name="field01<%=id%>"><br>
    <%next%>然后在后台取得
    checkFlag = request.form("checkFlag")
    从中取得要更改的Id,
    然后组合数据字段"field01 & " & id,来取得更改的值组合SQL,条件为ID,执行SQL。。就完成了
      

  4.   

    <%
    if request("action")="modi" then
    for i=0 to ubound(split(request("seleon"),","))
    conn.execute "update ysfw set district='" & split(request("district" & split(request("seleon"),",")(i)),",")(i) & "',name='" & split(request("nam" & split(request("seleon"),",")(i)),",")(i) & "',content='" & split(request("content" & split(request("seleon"),",")(i)),",")(i) & "',address='" & split(request("address" & split(request("seleon"),",")(i)),",")(i) & "',phone='" & split(request("phone" & split(request("seleon"),",")(i)),",")(i) & "' where id=" & split(request("seleon"),",")(i)
    next Response.Write "<script language=javascript>alert('修改完毕');</script>"
    end if if request("action")="dele" then
    conn.execute "delete from ysfw where id in (" & request("seleon") & ")"
    Response.Write "<script language=javascript>alert('删除完毕');</script>"
    end if
    %>
    <form name = modify >
      <table border="0" width="776" cellspacing="0" cellpadding="0" height="115">
        <tr>
          <td width="100%" bgcolor="#FCF6E5" height="1" valign="top" style="padding-left: 50; padding-top: 0">
            <p align="left"><img border="0" src="image/tb1.gif" width="100" height="28"></td>
        </tr>
        <center>
        <tr>
          <td width="100%" bgcolor="#FFFFFF" height="137" valign="top" style="padding-top: 0">
            <table border="0" width="100%" cellspacing="0" cellpadding="0" height="190">
              <tr>
                <td width="7%" bgcolor="#FDFAEE" height="37" valign="top"><img border="0" src="image/xx.htm1.gif" width="182" height="67"></td>
                <td width="91%" height="190" valign="top" rowspan="2">
            <div align="center">                              
                 <%     
                 dim leibie
                 dim rs  
                 dim pagecount             
         leibie=request.querystring("lb")  
         keyword=request.querystring("key")
         set rs=server.createobject("adodb.recordset") 
        if leibie="" then 
        rs.open "select * from ysfw where bz='1'",conn,1,1
     else
        rs.open "select * from ysfw where bz='1' and district like '%"&leibie&"%' and name like '%"&keyword&"%' order by district",conn,1,1 
     end if                               
                     if rs.eof and rs.bof then
                %>
                <table border="1" width="96%" bordercolor="#000000" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
                <tr>
                  <td width="10%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#F8EBC2"> 公司资料列表</td>              
                </tr>
                <tr>
                  <td width="10%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"> 暂时还没有需要修改的资料</td>              
                </tr>
       </table>
                <%
                else
    rs.pagesize=6
    pagecount = rs.pagecount
    page =request.querystring("page")
     if (page <> "") then
                       if (isnumeric(page)) then
                          page = clng(page)
                        else
                          page = 1 
                       end if
                     else
                       page = 1
                     end if
    if page<1 then page=1
    if page>rs.pagecount then page=rs.pagecount
    rs.absolutepage=page         
       %>

              <table border="1" width="96%" bordercolor="#000000" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
                <tr>
               
                 
      <td width="2%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2"> 选
                  &nbsp;</td>   
                  <td width="10%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2" >区&nbsp;&nbsp;  
                    名</td>
                  <td width="20%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2">名&nbsp;  
                    称</td>
                  <td width="20%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2">服务&nbsp;  
                    内容</td>  
                  <td width="30%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2">地址</td>              
                  <td width="18%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#F8EBC2">电&nbsp;  
                    话</td>
                    
                </tr> 
                <%for i=1 to rs.pagesize%>
                <tr  bgcolor="#99ccff" >   
                 <td width="2%" align="center" style="line-height: 150%; font-size: 10pt" bgcolor="#FDFAEE"><input  name="seleon"  type=checkbox  value="<%=rs("id")%>" ></td>
                 <td width="10%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text  id="district<%=rs("id")%>" name="district<%=rs("id")%>" value=<%=rs("district")%> ></td>
                 <td width="20%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text name="nam<%=rs("id")%>" value="<%=rs("name")%>"></a></td>
                 <td width="20%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text name="content<%=rs("id")%>" value=<%=rs("content")%>></td> 
                 <td width="30%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text name="address<%=rs("id")%>" value=<%=rs("address")%>></td>
                 <td width="18%" align="center" style="line-height: 150%; font-size: 9pt" bgcolor="#FDFAEE"><input type=text name="phone<%=rs("id")%>" value=<%=rs("phone")%>></td>
                
                </tr>
            <%
              rs.movenext 
              if rs.eof then exit for
               next
            %>
             </table>   
             <input type=button onclick="modi()" value="修改">&nbsp;&nbsp;<input type=button onclick="dele()" value="删除">
             <input type="hidden" name="lb" value="<%=request("lb")%>">
             <input type="hidden" name="key" value="<%=request("key")%>">
        </form> 
    <SCRIPT LANGUAGE=javascript>
    <!--
    function modi()
    {
    document.modify.method="POST";
    document.modify.action="yourpage.asp?action=modi";
    document.modify.submit();
    }

    function dele()
    {
    document.modify.method="POST";
    document.modify.action="yourpage.asp?action=dele";
    document.modify.submit();
    }
    //-->
    </SCRIPT>
      

  5.   

    我假设你的这个页面为yourpage
      

  6.   

    修改删除都在页面最上部的代码部分<%
    if request("action")="modi" then
    for i=0 to ubound(split(request("seleon"),","))
    conn.execute "update ysfw set district='" & split(request("district" & split(request("seleon"),",")(i)),",")(i) & "',name='" & split(request("nam" & split(request("seleon"),",")(i)),",")(i) & "',content='" & split(request("content" & split(request("seleon"),",")(i)),",")(i) & "',address='" & split(request("address" & split(request("seleon"),",")(i)),",")(i) & "',phone='" & split(request("phone" & split(request("seleon"),",")(i)),",")(i) & "' where id=" & split(request("seleon"),",")(i)
    next Response.Write "<script language=javascript>alert('修改完毕');</script>"
    end if if request("action")="dele" then
    conn.execute "delete from ysfw where id in (" & request("seleon") & ")"
    Response.Write "<script language=javascript>alert('删除完毕');</script>"
    end if
    %>
      

  7.   

    http://blog.csdn.net/iuhxq/archive/2004/09/24/115990.aspx
      

  8.   

    Microsoft VBScript 运行时错误 错误 '800a0009' 下标越界: 'i' /modify.asp,行98 98行为conn.execute "update ysfw set district='" & split(request("district" & split(request("seleon"),",")(i)),",")(i) & "',name='" & split(request("nam" & split(request("seleon"),",")(i)),",")(i) & "',content='" & split(request("content" & split(request("seleon"),",")(i)),",")(i) & "',address='" & split(request("address" & split(request("seleon"),",")(i)),",")(i) & "',phone='" & split(request("phone" & split(request("seleon"),",")(i)),",")(i) & "' where id=" & split(request("seleon"),",")(i)
    原因是:for i=0 to ubound(split(request("seleon"),",")) 中的 ubound(split(request("seleon"),",")) 吧,怎么解决?