请问类似信箱里一组删除功能是怎么实现的?

agent007 2003-10-18 08:37:14
就是象免费信箱里在邮件标题的左侧都有一列复选框,在选中一些复选框之后按删除按钮以后就可以删除选定邮件。请问是如何识别要删除的邮件和怎么实现的呢?能讲明白原理我就会懂了,最好给我一段ASP代码我就更容易理解了,谢谢!
...全文
91 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hare007 2003-10-24
  • 打赏
  • 举报
回复
Microsoft JET Database Engine 错误 '80040e14'
语法错误 (操作符丢失) 在查询表达式 'ID in()' 中。


Miriamy 2003-10-19
  • 打赏
  • 举报
回复
//function.js

function CheckAll(){
var i=0;
var arrayCheckbox = document.getElementsByName("checkbox")
for(i=0;i<arrayCheckbox.length;i++){
arrayCheckbox[i].checked=true;
}
}

function CheckOther(){
var i=0;
var arrayCheckbox = document.getElementsByName("checkbox")
for(i=0;i<arrayCheckbox.length;i++){
arrayCheckbox[i].checked=false;
}
}
///////////////////////////////////////////
提交页

html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form>
<input type="checkbox" name="checkbox" value="c1">
<input type="checkbox" name="checkbox" value=" c2">
<input type="button" name="Button" value="全选" onClick="CheckAll();">
<input type="button" name="Button" value="反选" onClick="CheckOther();">
<input type="submit" name="Button" value="提交">
</form>
</body>
</html>
///////////////////////////////////////////////////////////
执行页

conn.execute("delete from 表 where id in ("& request.form("checkbox")&")")
happymingnan 2003-10-19
  • 打赏
  • 举报
回复
根本不用怎么长的代码,2句话:
1.页面用:
<input type="checkbox" name="checkbox" value="1">
<input type="checkbox" name="checkbox" value="2">
<input type="checkbox" name="checkbox" value="3">
<input type="checkbox" name="checkbox" value="4">
2删除动作,
sql语句:"delete from 表 where id in("& request.form("checkbox") &")"

如果是access表 sql语句改为:
"delete * from 表 where id in("& request.form("checkbox") &")"
qdubit 2003-10-18
  • 打赏
  • 举报
回复
上贴没完,接上贴:

<table border=0 cellpadding=1 cellspacing=1 width=99% bgcolor="#808080" align="center">
<tr bgcolor=#333366>
<td class=fctitle width="1%" bgcolor="#5A965B">
<INPUT TYPE=CHECKBOX NAME="SELECTALL" onclick="CheckAll(this.form)">
</td>
<td class=fctitle align=center nowrap width="1%" bgcolor="#5A965B"><nobr> <a href="/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=folder&sort=P0" style="color: #ffffff; text-decoration: none;" title="按优先级排序"><font color=#ff0000><b>!</b></font></a> <font color=#FFFF00><font></nobr>
</td>
<td class=fctitle align=center nowrap width="1%" bgcolor="#5A965B"><nobr> <a href="/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=folder&sort=A0" style="color: #ffffff; text-decoration: none;" title="按是否有附件排序">附件</a> <font color=#FFFF00><font></nobr>
</td>
<td class=fctitle align=center nowrap width="1%" bgcolor="#5A965B"><nobr> <a href="/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=folder&sort=N0" style="color: #ffffff; text-decoration: none;" title="按未读信件排序">新信</a> <font color=#FFFF00><font></nobr>
</td>
<td class=fctitle align=center nowrap width="30%" bgcolor="#5A965B"><nobr> <a href="/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=folder&sort=F0" style="color: #ffffff; text-decoration: none;" title="按收信人地址排序">收件人</a> <font color=#FFFF00><font></nobr>
</td>
<td class=fctitle align=center nowrap width="46%" bgcolor="#5A965B"><nobr> <a href="/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=folder&sort=S0" style="color: #ffffff; text-decoration: none;" title="按主题排序">主 题</a> <font color=#FFFF00><font></nobr>
</td>
<td class=fctitle align=center nowrap width="18%" bgcolor="#5A965B"><nobr> <a href="/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=folder&sort=D1" style="color: #ffffff; text-decoration: none;" title="按日期排序">日 期</a> <font color=#FFFF00>↑<font></nobr>
</td>
<td class=fctitle align=center nowrap width="2%" bgcolor="#5A965B"><nobr> <a href="/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=folder&sort=L0" style="color: #ffffff; text-decoration: none;" title="按大小排序">大小</a> <font color=#FFFF00><font></nobr>
</td>
</tr>
<tr class=fceven>
<td>
<input type=checkbox name="MOVE-0" onclick="unCheckSingle(this.form, this)">
<input type=hidden name="MOVEFILE-0" value="1061424032.13104.mail,S=158:2,S">
</td>
<td> <font color=#ff0000><b></b></font>
</td>
<td align=center><!--<image src=/csmail/images/attach.gif>--> 
</td>
<td align=center><!--<div id=newtag0><img src=/csmail/images/blank.gif width=11 height=12 alt="" hspace=5 align=center border=0></div>--> 
</td>
<td nowrap> <nobr>ming.liu@topsun.com</nobr> 
</td>
<td nowrap> <nobr><A HREF="javascript:OpenMsg('/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=newmsg&resend=1&pos=0')">jbzgcs&lets</A></nobr> 
</td>
<td nowrap>2003-08-21 08:00
</td>
<td nowrap> <nobr>0.1K</nobr>
</td>
</tr>
<tr class=fcodd>
<td>
<input type=checkbox name="MOVE-1" onclick="unCheckSingle(this.form, this)">
<input type=hidden name="MOVEFILE-1" value="1061423926.12859.mail,S=2558417:2,S">
</td>
<td> <font color=#ff0000><b></b></font>
</td>
<td align=center><image src=/csmail/images/attach.gif> 
</td>
<td align=center><!--<div id=newtag1><img src=/csmail/images/blank.gif width=11 height=12 alt="" hspace=5 align=center border=0></div>--> 
</td>
<td nowrap> <nobr>ming.liu@topsun.com</nobr> 
</td>
<td nowrap> <nobr><A HREF="javascript:OpenMsg('/cgi-bin/wmaila/login/1339010241061424157?folder=Sent&form=newmsg&resend=1&pos=1')">东盛远程销售管理系统设计说明书</A></nobr> 
</td>
<td nowrap>2003-08-21 07:58
</td>
<td nowrap> <nobr>2.4M</nobr>
</td>
</tr>

<TR BGCOLOR="#EEEEEE">
<TD COLSPAN=8 NOWRAP bgcolor="#EEEEEE" height="36"> 
<INPUT TYPE=HIDDEN NAME=pos VALUE="">
<INPUT TYPE=SUBMIT NAME=cmddel VALUE="删除" onClick="return DelToTrash(this.form);"><nobr> </nobr>
<INPUT TYPE=SUBMIT NAME=delout VALUE=永久删除 onClick="return DelOut(this.form);"><nobr> </nobr>转移到
<SELECT NAME=moveto onchange="return DoMove(this.form);">
<OPTION value=0 selected> --选择文件夹--
<OPTION VALUE="INBOX">收件箱<OPTION VALUE="Backup">Backup<OPTION VALUE="Trash">垃圾箱
<OPTION name="createfldr" value="createfldr">[创建文件夹]
</SELECT><nobr> </nobr>
<INPUT TYPE=SUBMIT NAME=cleantotrash VALUE="清空文件夹" onClick="CleanToTrash();">
<!--
<SELECT NAME=markas onchange="return Remark(this.form);">
<OPTION value=0 selected> --改变邮件状态--
<OPTION value=remarkasnew>标记为未读
<OPTION value=markasread>标记为已读
</SELECT>
-->
<INPUT TYPE=HIDDEN NAME=cmdmove VALUE=0>
</TD>
</TR>

</table>
</td>
</tr>
</tbody>
</table>
</form>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
<tr>
<td align="right">
<hr size="2" color="#337528">
康易网 Copyright 2000-2003</td>
</tr>
</table>

</center>
</body>
</html>
qdubit 2003-10-18
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">

<!--
var loaded = false;
var deltype = 0;
var ie = document.all ? 1 : 0;

function hL(E) {
if (ie) {
while (E.tagName != "TR") {
E = E.parentElement;
}
}
else {
while (E.tagName != "TR") {
E = E.parentNode;
}
}
E.className = "H";
}

function dL(E) {
if (ie) {
while (E.tagName != "TR") {
E = E.parentElement;
}
}
else
{
while (E.tagName != "TR") {
E = E.parentNode;
}
}
E.className = "fceven";
}

function CheckAll(form) {
for (var i = 0;i < form.elements.length; i++)
{
var e = form.elements[i];
if (e.name.indexOf("MOVE-") >= 0) {
e.checked = form.SELECTALL.checked;
if (form.SELECTALL.checked)
hL(e);
else
dL(e);
}
}
}

function unCheckSingle(form, obj) {
if (obj.checked)
hL(obj);
else
dL(obj);
for (var i = 0;i < form.elements.length; i++)
{
var e = form.elements[i];
if (e.name.indexOf("MOVE-") == 0) {
if (e.checked == 0) {
form.SELECTALL.checked = 0;
return;
}
}
}
form.SELECTALL.checked=1;
}

function IsAnyoneChecked(form) {
for (var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if (e.name.indexOf("MOVE-") == 0 && e.checked)
return true;
}
return false;
}

function DoMove(form) {
// if (form.moveto.value == "createfldr") {
if (form.moveto[form.moveto.selectedIndex].name == "createfldr") {
location.href = "/cgi-bin/wmaila/login/1339010241061424157?folder=INBOX&form=newfolder";
return false;
}
if (!IsAnyoneChecked(form)) {
alert("您未选择任何电子邮件。请单击您要选择的电子邮件旁边的复选框。");
form.moveto.selectedIndex = 0;
return false;
}
if (form.moveto.value != "0") {
form.cmdmove.value = '1';
form.submit();
}
}

function Remark(form) {
if (!IsAnyoneChecked(form)) {
alert("您未选择任何电子邮件。请单击您要选择的电子邮件旁边的复选框。");
form.markas.selectedIndex = 0;
return false;
}
if (form.markas.value != "0")
form.submit();
}

function OpenMsg(url) {
today = new Date();
id = today.getTime();
var hWnd = window.open(url,id,"width=640,height=640,resizable=yes,scrollbars=yes");
if ((document.window != null) && (!hWnd.opener))
hWnd.opener = document.window;
hWnd.focus();
return;
}

function RemoveNewTag(id) {
if(!loaded) return;
if(document.all) {
var tag_id = "newtag" + id;
var tag = document.all.item(tag_id);
if(tag) {
tag.innerHTML = "";
return;
}
}
document.location.reload(true);
}

function OnLoadHandler() {
loaded = true;
}

function OnUnloadHandler() {
loaded = false;
}

function Confirm_Del() {
if (deltype == 1) { //delete to trash
// if ( confirm("如果您确实要将选中信件删除到垃圾箱,请点击\"确定\",否则,点击\"取消\"") ) {
// return true;
// }
// else
// return false;
}
else if (deltype == 2) { //delete out
if ( confirm("如果您确实要将选中信件永久删除,请点击\"确定\",否则,点击\"取消\"") ) {
return true;
}
else
return false;
}
else if (deltype == 3) { //clean all emails in this folder to TRASH
if ( confirm("如果您确实要将所有信件删除到垃圾箱,请点击\"确定\",否则,点击\"取消\"") ) {
return true;
}
else
return false;
}
else if (deltype == 4) { //clean all emails in TRASH
if ( confirm("如果您确实要将清空垃圾箱,请点击\"确定\",否则,点击\"取消\"") ) {
return true;
}
else
return false;
}
else if (deltype == 0) { //move to other folders
return true;
}
}

function DelToTrash(form) {
if (IsAnyoneChecked(form)) {
deltype = 1;
return true;
}
else {
alert("您未选择任何电子邮件。请单击您要选择的电子邮件旁边的复选框。");
return false;
}
}

function DelOut(form) {
if (IsAnyoneChecked(form)) {
deltype = 2;
return true;
}
else {
alert("您未选择任何电子邮件。请单击您要选择的电子邮件旁边的复选框。");
return false;
}
}

function CleanToTrash(form) {
deltype = 3;
}

function CleanTrash(form) {
deltype = 4;
}

//-->

</script>
<link rel="stylesheet" href="/csmail/css/css.css" type="text/css">
<style type="text/css">
.fcodd {background: #ffffff;}
.fceven {background: #ffffff;}
.H {background: #C3D6E6;}
</style>
<title>文件夹
</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#0000EF" alink="#FF0000" topmargin=0 leftmargin=0 rightmargin=0 marginwidth=0 marginheight=0 onload="OnLoadHandler();" onunload="OnUnloadHandler();">
<center>
<table border=0 cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr valign="top">
<td>
<form method="post" name="delete" action="/cgi-bin/wmaila/login/1339010241061424157" onsubmit="return Confirm_Del()">
<INPUT TYPE=HIDDEN NAME="folder" VALUE="Sent"><input type="hidden" name="form" value="folderdel">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>

<table WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
<tr valign=top>
<td>
<table width=100% cellpadding=4 cellspacing=0 border=0>
<tr>
<td CLASS="Td-Title"> <font style="font-size: 9pt; color: #000000"><a href=/cgi-bin/wmaila/login/1339010241061424157?folder=INBOX&form=folders
face=verdana,geneva,helvetica style="text-decoration:
none; font-size: 10.5pt; "> ming.liu@topsun.com</a>
<font style="font-size: 9pt; color: #000000"> : </font><font style="font-size: 9pt; color: #000000">已发送邮件</font>
</td>
</tr>
</table>
</td>
<td valign=middle align=right CLASS="Td-Title">
</td>
</tr>
</table>
<table WIDTH="90%" BORDER=0 CELLPADDING=2 CELLSPACING=0 align="center">
<tr>
<td nowrap>
<table border=0 cellspacing=1 cellpadding=4 width="100%">
<tr>
<td class=fccount> 第1-2封 / 共2封   第 <font color=#ff0000>[1]</font> 页
</td>
</tr>
</table>
</td>
</tr>
</table>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧