(求助)复选框全选不能实现
我想通过复选框全选,删除数据库记录,但点击全选前面小框,没有反应!代码用在别的网页没问题,请大虾们帮看看,代码如下(关键代码为红色):<!--#include file="inc.asp"-->
<!--#include file="qq_dgconn.asp"-->
<script language="JavaScript" type="text/JavaScript">
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name == 'fID'){
e.checked = form.chkall.checked;
}
}
}</script>
<%
If bbs94kk.myadmin<>9 Then
Response.Write"<script>alert('对不起,您不是管理员,不能进入!');location.replace('index.asp')</script>"
end if
bbs94kk.head("管理点歌列表")
dim sql,rs,i,page_count,Pcount,totalrec,mytotalrec,currentPage,Content
totalrec=connDG.execute("select count(id) from media")(0)
mytotalrec=connDG.execute("select count(id) from media where incept='"&bbs94kk.myname&"' or incept='全体会员'")(0)
Content=Content&"<table border='0' cellpadding=0 cellspacing=0 align=center width='100%'><tr height='25'><th><a href=qq_dglistall.asp>所有点歌列表</a></th><th><a href=qq_dglistme.asp>我的点歌列表</a></th><th><a href=qq_dgwrite.asp>我要点歌</a></th></tr>"&_
"<tr><td align=center valign=middle colspan='3'><a href=qq_dglistall.asp><b>论坛总点歌列表</b></a>清单共有[<font color=red><b>"&totalrec&"</b></font>]个,其中<a href=qq_dglistme.asp>[<b>"&bbs94kk.myname&"</b>]</a>的祝福清单共有[<font color=red><b>"&mytotalrec&"</b></font>]个。<font color=green><直接点击歌名欣赏></font></td></tr></table><br>"&_
"<form name='kk' method='POST' action='del.asp?Action=DelOptFile'><table border='1' cellpadding=0 cellspacing=0 align=center width='100%'><tr height='25'><th colspan=7>--== 论坛点歌台-管理点歌列表 ==--</th></tr><tr><td width='10%' height='22' align=center>点歌人</td><td width='10%' height='22' align=center>对方姓名</td><td width='15%' height='22' align=center>歌名</td><td width='16%' height='22' align=center>时间</td><td width=* height='22' align='center'>祝福语</td><td width='10%' height='22' align=center colspan='2'>操作</td></tr>"
set rs=server.createobject("adodb.recordset")
sql="select * from media Order By sendtime Desc"
rs.open sql,connDG,1,1
if rs.eof and rs.bof then
currentpage=0
Content=Content&"<tr><td valign=middle colspan=6>当前没有点歌列表</td></tr>"
else
currentPage=request.querystring("page")
if currentpage="" or isNumeric(currentpage) = 0 then
currentpage=1
else
currentpage=clng(currentpage)
if err then
currentpage=1
err.clear
end if
end if
rs.PageSize = 10
rs.AbsolutePage=currentpage
page_count=0
totalrec=rs.recordcount
while (not rs.eof) and (not page_count = rs.PageSize)
Content=Content&"<tr><td align=center valign=middle><a href='userinfo.asp?name="&rs("sender")&"'><font color=blue>"&rs("sender")&"</font></a></td><td align=center valign=middle>"
if trim(rs("incept"))<>"全体会员" then
Content=Content&"<a href='userinfo.asp?name="&rs("incept")&"')><font color=#CC66FF>"&rs("incept")&"</font></a>"
else
Content=Content&"<font color=olive>"&rs("incept")&"</font>"
end if
Content=Content&"</td><td align=center valign=middle><a href='qq_dgplay.asp?url="&replace(rs("url"),chr(32),"%20",1)&"&medianame="&replace(rs("medianame"),chr(32),"%20")&"' target=_blank>"&rs("medianame")&"</a></td><td align=center valign=middle>"&rs("sendtime")&"</td><td align=left valign=middle>"&rs("content")&"</td><td align=center valign=middle><a href=qq_dgedit.asp?id="&rs("id")&">[编辑]</a></td><td align=center valign=middle><input type='checkbox' name='fID' value='"&rs("id")&"'> </td></tr>"
page_count = page_count + 1
rs.movenext
wend
end if
Content=Content&"</table>"
Content=Content&"<table border='0' cellpadding='0' cellspacing='0' align=center width='100%'><tr height='25'><td align=center><input type=checkbox name=chkall value=on onClick='CheckAll(this.form)'> 全选 <input class='button' value='删除所选' type='button' onclick=""if(confirm('删除后将不能恢复!您确定要删除吗?'))form.submit()"" /></FORM></td></tr></table>"
dim endpage
Pcount=rs.PageCount
Content=Content&"<table border=0 cellpadding=0 cellspacing=0 Width='100%' align=center><tr><td valign=middle nowrap>页次:<b>"¤tpage&"</b>/<b>"&Pcount&"</b>页每页<b>10</b>条共有<b>"&totalrec&"</b>条点歌</td><td valign=middle nowrap><div align=right><p>分页:"
if currentpage > 4 then
Content=Content&"<a href=""?page=1"">[1]</a> ..."
end if
if Pcount>currentpage+3 then
endpage=currentpage+3
else
endpage=Pcount
end if
for i=currentpage-3 to endpage
if not i<1 then
if i = clng(currentpage) then
Content=Content&"<font color=red>["&i&"]</font>"
else
Content=Content&"<a href=""?page="&i&""">["&i&"]</a>"
end if
end if
next
if currentpage+3 < Pcount then
Content=Content&"... <a href=""?page="&Pcount&""">["&Pcount&"]</a>"
end if
Content=Content&"</p></div></font></td></tr></table>"
Call BBS94KK.ShowTable("管理点歌列表",Content)
rs.close
set rs=nothing
call CloseDB()
bbs94kk.footer()
%>
[[it] 本帖最后由 thbwn 于 2008-2-10 00:52 编辑 [/it]]