📄 sitetype_admin.asp
字号:
<!--#include file="admin.asp"-->
<%
if request("action")="add" then
chk_admin_login(1)
n_sitetype=Request.Form("n_sitetype")
If not conn.Execute("select * From [siteclass] where sitetype='"&n_sitetype&"'").eof Then
Response.Write "<script language='javascript'>alert('对不起,"&n_sitetype&"已经存在,请后退重填!!');location.href='javascript:history.back()'</script>"
else
sql="select * from siteclass"
rs.open sql,conn,1,3
rs.addnew
rs("sitetype")=n_sitetype
rs.update
rs.close
set rs=nothing
response.redirect "sitetype_admin.asp"
end if
end if
if request("action")="edit" then
chk_admin_login(3)
id=request("id")
new_name=request.Form("new_name")
sql="select * from [siteclass] where id="&id
rs.open sql,conn,1,3
rs("sitetype")=new_name
rs.update
rs.close
response.write"<script>alert('修改成功!');location.href='sitetype_admin.asp'</script>"
end if
if request("action")="del" then
chk_admin_login(3)
sql="select * from siteclass where id="&request.form("delid")
rs.open sql,conn,1,3
rs.delete
rs.close
set rs=nothing
response.redirect "sitetype_admin.asp"
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理类别</title>
<link rel=stylesheet href="../css/admin.css" type="text/css">
<script language="JavaScript">
function check_input()
{
if (form1.n_sitetype.value=="")
{ alert("请输入类别名称!");
form1.n_sitetype.focus();
return false;
}
return true;
}
function check_input2()
{
if (form2.id.value=="")
{ alert("请选择类别!");
form2.id.focus();
return false;
}
if (form2.new_name.value=="")
{ alert("请填写新的类别名称!");
form2.new_name.focus();
return false;
}
return true;
}
function check_input3()
{
if (form3.delid.value=="")
{ alert("请选择要删除的类别!");
form3.delid.focus();
return false;
}
if(confirm("确定要删除此类别吗?"))
return true;
else
return false;
}
</script>
</head>
<body>
<table width="400" border="1" align="center" cellpadding="4" cellspacing="0" class="table-line">
<tr class="td-title-color">
<td height="30"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="shadow">添加类别:</td>
</tr>
</table></td>
</tr>
<form name="form1" method="POST" action="?action=add" onsubmit="return check_input()">
<tr>
<td onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'">输入名称:
<input name="n_sitetype" type="text" id="n_sitetype" size="20">
<input name="submit" type="submit" value="添加"> </td>
</tr>
</form>
</table>
<p></p>
<table width="400" border="1" align="center" cellpadding="4" cellspacing="0" class="table-line">
<form name="form2" method="post" action="?action=edit" onsubmit="return check_input2()">
<tr class="td-title-color">
<td height="30" colspan="2"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="shadow">修改类别:</td>
</tr>
</table></td>
</tr>
<tr onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'">
<td width="210" align="right">选择类别:</td>
<td width="506"><%
sql="select * from siteclass"
rs.open sql,conn,1,1
%><select name="id" size="1" id="id">
<option selected value="">请选择</option>
<%do while not rs.eof%>
<option value=<%=rs("id")%>><%=rs("sitetype")%></option>
<%rs.movenext
loop
rs.close
set rs=nothing
%>
</select> </td>
</tr>
<tr onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'">
<td align="right">新的名称:</td>
<td><input name="new_name" type="text" id="s_name22"></td>
</tr>
<tr onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'">
<td align="right"> </td>
<td><input type="submit" name="Submit2" value="修改"></td>
</tr>
</form>
</table>
<p></p>
<table width="400" border="1" align="center" cellpadding="4" cellspacing="0" class="table-line">
<tr class="td-title-color">
<td width="710" height="30"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="shadow">删除类别:</td>
</tr>
</table></td>
</tr>
<tr>
<form name="form3" method="post" action="?action=del" onsubmit="return check_input3()">
<td onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'"> <%
set rs2=server.createobject("ADODB.Recordset")
sql2="select * from siteclass"
rs2.open sql2,conn,1,1
%>选择:<select name="delid" size="1">
<option selected value="">请选择</option>
<%do while not rs2.eof%>
<option value=<%=rs2("id")%>><%=rs2("sitetype")%></option>
<%rs2.movenext
loop
rs2.close
set rs2=nothing
%>
</select> <input type="submit" name="Submit3" value="删除">
</td>
</form>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -