东平县城最新招工信息:帮帮忙看看这段代码~~

来源:百度文库 编辑:高考问答 时间:2024/04/30 02:27:49
删除和全选功能都用不了,不知道怎么回事

<SCRIPT>
function CheckAll(form)
{
for (var k=0;k<form.elements.length;k++)
{
var e = form.elements[i];
if (e.name != 'chkall' )
e.checked = form.chkall.checked;
}
}
</SCRIPT>
<% if action="" then%>
<div align="center">
<table border="0" width="68%" cellspacing="0" cellpadding="0">
<tr>
<td><u><b><font size="2">删除曲目</font></b></u></td>
<td> </td>
</tr>
</table>
<table>
<form action="delmusic.asp" method=post name=delmusic>
<%
dim songname,singer,special,adddate,i,id,action
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from musiclist",conn,1,1
i=1
do while not rs.eof
songname=rs("songname")
singer=rs("singer")
adddate=rs("adddate")
special=rs("special")
id=rs("id")
%>
<tr>
<td width="47"><p align="center"><span style="font-size: 9pt"><%=i%></span>
</td>
<td width="7"> </td>
<td width="161"><span style="font-size: 9pt"><%=songname%></span></td>
<td width="11"> </td>
<td width="69"><span style="font-size: 9pt"><%=singer%></span></td>
<td width="7"> </td>
<td width="126"><span style="font-size: 9pt"><%=special%></span></td>
<td width="11"> </td>
<td width="183"><span style="font-size: 9pt"><%=adddate%></span></td>
<td width="6"><span style="font-size: 9pt"> </span></td>
<td width="48">
<p align="center"><input type="checkbox" name="id" value="<%=rs("id")%>">
<%i=i+1
rs.MoveNext
loop
rs.close
set rs=nothing
%><tr>
<td width="54" colspan="2"> </td>
<td width="622" colspan="9">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="40"><input onclick="{if(confirm('该操作不可恢复!\n\n确定删除选定的曲目?')){this.document.newslist.submit();return true;}return false;}" type="submit" value="删除" name="B1"></td>
<td width="78"> </td>
<td><INPUT onclick=CheckAll(delmusic) type=checkbox value=on name=chkall><font style="font-size: 11pt">全选</font> </td>
</table>
</from>
</table>
<%
end if
if action="删除" then
delid=replace(request("id")," ","")
call songdel()
end if
sub songdel()
delid=request("id")
if Delid="" or isnull(Delid) then
response.write "<script language='javascript'>"
response.write "alert('操作失败,您什么也没有选择。');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if
Set rs=Server.CreateObject("ADODB.Recordset")
sql="del * from musiclist where id in ("&Delid&")"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
response.write "<script language='javascript'>"
response.write "alert('出错了,歌曲不存在或者已经被删除。');"
response.write "</script>"
response.end
else
Do while not rs.eof
rs.movenext
loop
rs.close
set rs=nothing
response.write "<script language='javascript'>"
response.write "alert('所选歌曲已被删除,单击“确定”返回!');"
response.write "location.href='order1.asp';"
response.write "</script>"
end if
end sub
%>