关于批量修改-动态下拉菜单给值问题
20101227.zip
(34.69 KB)
附件我目的是由上面的下拉菜单选值,比如我选如图所示选专辑编号15 那么下面的所有[专辑编号] 就自动变成15
现在以下的代码只能一个个来修太麻烦拉,记录少点倒可以要是有几百件那就累死!请求版主们或高手帮忙解决下 昨晚研究了一天没则!
程序代码:
<!--#include FILE="conn.asp"--> <%'这段参照论谈某贴yms123版主写的动态下拉菜单选值 set rs=server.createobject("adodb.recordset") sqltext="select * from class " rs.open sqltext,conn,1,1 %> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head> <body> <script language="javascript"> function p_id_Change(val) { var albumTxt=document.getElementById("p_album"); var usernameTxt=document.getElementById("p_username"); var tAry=val.split('|'); albumTxt.value=tAry[0]; usernameTxt.value=tAry[1]; } </script> <select name="p_id" id="p_id" onChange="p_id_Change(this.options[this.selectedIndex].value);"> <%do while not rs.eof %> <option value="<%= rs("album")%>|<%= rs("username")%>" ><%= rs("id") %> </option> <% rs.movenext loop%> </select> <input name="p_album" type="text" id="p_album"> <input name="p_username" type="text" id="p_username"> <%'以下是主要是批量修改,我目的是由上面的下拉菜单选值,比如我先如图所示15 那么下面的所有[专辑编号] 就自动变成15 if request("action")="edit" then id=request("id") album=request("album") username=request("username") id1=split(id,",") album1=split(album,",") username1=split(username,",") for i = 0 to ubound(id1) set rs=server.CreateObject("adodb.recordset") rs.open "select * from music where id="&id1(i) ,conn,1,3 rs("album")=trim(album1(i)) rs("username")=trim(username1(i)) rs.Update rs.Close set rs=nothing next end if %> <form method="post" action="?action=edit" name="form"> <table> <tr> <td>ID</td> <td>专辑编号</td> <td>用户</td> </tr> <% sql="select * from music order by album asc,id asc" set rs=Server.CreateObject("ADODB.Recordset") rs.open sql,conn,1,3 if rs.eof and rs.bof then else do while not rs.eof %> <tr> <td><input type="hidden" name="id" value="<%=rs("id")%>"><%=rs("id")%></td> <td><input type="text" name="album" value="<%=rs("album")%>"></td> <td><input type="text" name="username" value="<%=rs("username")%>"></td> </tr> <% rs.movenext loop end if rs.close set rs = nothing conn.close set conn = nothing %> <tr> <td colspan="3" align="center"><input name="submit" type="submit" value="修改"></td> </tr> </table> </form> </body>
[ 本帖最后由 ningzhonghui 于 2010-12-27 10:29 编辑 ]