📄 dc.asp
字号:
sql="select * from dctitle order by dateandtime desc"
rs.open sql,conn,1,1
response.write "<option >请选择标题</option>"
do while not rs.eof
%>
<option value=<%=rs("id")%>><%=left(trim(rs("title")),25)%></option>
<%
rs.movenext
loop
rs.close
%>
</select> </td>
</tr>
<tr>
<td height="33" class="black"> <div align="right">选项:</div></td>
<td class="black"> </td>
<td class="black"> <input name="name" type="text" id="name2" size="45" maxlength=70>
</td>
</tr>
<tr>
<td height="50" colspan="3" valign="middle" class="black">
<div align="center">
<script language="JavaScript">
function saveexit()
{
if (chk()==0)
{
return false;
};
document.form3.submit();
}
function chk()
{
if (document.form3.titleid.value.length==0)
{
alert("请选择标题。");
document.form3.titleid.focus();
return 0;
};
if (document.form3.name.value.length==0)
{
alert("请填写名称。");
document.form3.name.focus();
return 0;
};
return 1;
}
</script>
</div>
<div align="center">
<input type="button" value=" 添加 " name="B1" onclick="javascript:return saveexit()">
<input type="reset" name="Reset" value="重写">
</div></td>
</tr>
</table></td>
</tr>
</table>
</center>
</div>
</form><%
end sub
sub list2
%><form method="post" action="?action=del2" name="form1">
<div align="center">
<center>
调查选项<br>
<br>
<div align="center">
<center>
<table border="0" width="86%" cellspacing="1" cellpadding="0">
<tr bgcolor="#AABFEC">
<td width="7%" align="center" height="28"> </td>
<td width="71%" align="center">目录名称</td>
<td width="22%" align="center"> </td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from dctitle order by dateandtime desc "
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
id=trim(rs("id"))
%>
<tr bgcolor="#Abbeee">
<td align="center" height="28"> </td>
<td align="center"><%=rs("title")%></td>
<td align="center"> </td>
</tr>
<%
set ps=server.createobject("adodb.recordset")
sql2="select * from dcdetail where titleid="&id&" order by id desc"
ps.open sql2,conn,1,1
do while not ps.eof
%>
<tr bgcolor="#CAD6F4">
<td width="7%" align="center" height="28"> <input type="checkbox" name="id" value="<%=ps("id")%>" class="mul">
</td>
<td width="71%" align="center"><%=ps("name")%> </td>
<td width="22%" align="center"><a href="?action=edit2&id=<%=ps("id")%>&titleid=<%=ps("titleid")%>">修改</a></td>
</tr>
<%
ps.movenext
loop
ps.close
set ps=nothing
%>
<%
rs.movenext
loop
end if
%>
<tr>
<td colspan="3" align="center" height="50"> <input type="submit" value="删除" name="B1">
</td>
</tr>
</table>
</center>
</div>
</center>
</div>
</form><%
end sub
sub edit2
%><form method="post" action="?action=saveedit2" name="form3">
<div align="center">
<center>
调查选项修改<br>
<table border="0" width="70%" cellspacing="1" cellpadding="0" class="black" height="137">
<tr>
<td width="100%" valign="top" height="132"> <table border="0" width="100%" cellspacing="1" cellpadding="0" height="116">
<%
set rs=server.createobject("adodb.recordset")
id=request("id")
if id<>"" then
sql="select * from dcdetail where id="&id&" "
rs.open sql,conn,1,1
%>
<tr>
<td height="33" class="black"> <div align="right">调查选项:</div></td>
<td class="black"> </td>
<td class="black"><input type="text" name="name" size="39" value="<%=rtrim(rs("name"))%>">
</td>
</tr>
<tr>
<td height="2" colspan="3" valign="middle" class="black">
<div align="center">
<script language="JavaScript">
function saveexit()
{
if (chk()==0)
{
return false;
};
document.form3.submit();
}
function chk()
{
if (document.form3.name.value.length==0)
{
alert("请填写调查选项。");
document.form3.name.focus();
return 0;
};
return 1;
}
</script>
</div>
<div align="center">
<input type="hidden" name="id" value="<%=rs("id")%>">
<input type="button" value=" 修改 " name="B1" onclick="javascript:return saveexit()">
</div></td>
</tr>
<%
rs.close
end if
%>
</table></td>
</tr>
</table>
</center>
</div>
</form><%
end sub
sub del
ids=split(request("id"),",")
for i=0 to ubound(ids)
tt=ids(i)
conn.execute"delete from dctitle where id="&tt&""
conn.execute"delete from dcdetail where titleid="&tt&""
next
response.redirect"dc.asp"
end sub
sub saveadd
title=changechr(request("title"))
sql="insert into dctitle(title) values('"&title&"')"
conn.execute sql
response.redirect"dc.asp"
end sub
sub saveedit
id=RtnReplaceInt(request("id"),0)
title=changechr(request("title"))
conn.execute "update dctitle set title='"&title&"' where id="&id&""
response.redirect "dc.asp"
end sub
sub saveadd1
titleid=trim(request("titleid"))
name="'" & replace(trim(request("name")),"'","''") & "'"
conn.execute "insert into dcdetail(titleid,name) values ("&titleid&","&name&")"
response.redirect "dc.asp?action=list2"
end sub
sub del2
ids=split(request("id"),",")
for i=0 to ubound(ids)
tt=ids(i)
conn.execute"delete from dcdetail where id="&tt&""
next
response.redirect"dc.asp?action=list2"
end sub
sub saveedit2
id=RtnReplaceInt(request("id"),0)
name=changechr(request("name"))
conn.execute "update dcdetail set name='"&name&"' where id="&id&""
response.redirect "dc.asp?action=list2"
end sub
conn.close
set conn=nothing%>
<!--#include file="end.asp" -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -