sub delete()
set rs=server.createobject("adodb.recordset")
sql="select * from news order by id desc"
rs.open sql,conn,1,1
do until rs.eof
%>
<form name=news action=book_admin.asp method=post>
<table width="712" border="0" cellpadding="1" cellspacing="1">
<tr><td bgcolor="#CCCCCC" width=500><a href="news_read.asp?id=<%=rs("id")%>" target="_blank"><%=rs("title")%
></a></td><td><input type='checkbox' value='"&rs("ID")&"' name=newsid></tr>
<%
rs.movenext
loop %>
<tr><td><input type='checkbox' name=chkall onclick='CheckAll(this.form)'> 全选<input type="submit" name="action" value="删除
新闻" onclick="{if(confirm('该操作不可恢复!\n\n确实删除选定的新闻?')){this.document.Prodlist.submit();return true;}return
false;}"></td></tr>
</table>
</form>
<%
rs.close
set rs=nothing
if request("action")="删除新闻" then
newsid=replace(request("id"),"'","")
if delnewsid="" or isnull(delnewsid) then
response.write "<script language='javascript'>"
response.write "alert('操作失败,没有选择合适参数,请单击“确定”返回!');"
response.write "location.href='book_admin.asp';"
response.write "</script>"
response.end
else
delnews="delete * from news where id="&newsid
conn.execute(delnews)
conn.close
set conn=nothing
response.write "<script language='javascript'>"
response.write "alert('新闻删除成功,请单击“确定”返回!');"
response.write "location.href='book_admin.asp';"
response.write "</script>"
response.end
end if
end if
end sub
调用的其他都没有问题,就是这个删除不了新闻
參考答案:<input type='checkbox' value='"&rs("ID")&"' name=newsid>
应该为<input type="checkbox" value="<%=rs("ID")%>" name=newsid>