<scriptlanguage="javascript">
functionCheckAll(form)
{///定义函数checkall参数为form
for(vari=;i<formelementslength;i++)
///循环formelementslength得到表单里的控件个数
{
///把表单里的内容依依付给e这个变量
vare=formelements[i];
if(ename!=’chkall’)
echecked=formchkallchecked;
}
}
</script>
<formid="form"name="form"method="post"action="">
<tablewidth=""cellspacing=""cellpadding="">
<tr>
<tdwidth="">全选</td>
<tdwidth=""><inputname="chkall"type="checkbox"id="chkall"value="all"onclick="CheckAll(thisform)"/></td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td><inputname="id"type="checkbox"id="id"value=""/></td>
<td>标题</td>
</tr>
<tr>
<td></td>
<td><inputtype="submit"name="Submit"value="删除"/></td>
</tr>
</table>
</form>
如需传值到另一文件
deleteasp文件
<!#includefile="inc/connasp">
<%
Num=requestform("checkbox")count
ifNum=then
ResponseWrite("请选择要删除的新闻")
ResponseEnd
endif
ids=requestForm("checkbox")
sqlStr="Delete*FromindexadWhereidin("&ids&")"
connexecute(sqlStr)
Responseredirect(requestservervariables("http_referer"))
ResponseEnd
%>
方法
<%
Num=requestform("DelID")count
ifNum=then
ResponseWrite("请选择要删除的新闻")
ResponseEnd
endif
fori=toNum
setrs=ServerCreateObject("adodbRecordset")
sql="Select*fromNewswhereNewsID="&requestform("DelID")(i)
rsopensqlconn
ifnotrseofthen
connexecute("DeleteFromNewsWhereNewsID="&requestform("DelID")(i))
connexecute("DeleteFromReviewWhereNewsID="&requestform("DelID")(i))
else
ResponseWrite("新闻删除失败")
ResponseEnd
endif
rsclose
setrs=nothing
next
ResponseWrite("成功将选定新闻删除")
ResponseEnd
%>