📄 class_manage.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="Cookies.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.style1 {color: #0000FF}
.style3 {color: #FF0000}
.style5 {color: #FF0033}
.style6 {color: #FF0066}
-->
</style>
</head>
<SCRIPT language="vbscript">
<!--
function checkdata()
If document.addclass1.classtext.value="" then
alert("分类名不能为空")
document.location.reload()
exit function
end if
end function
-->
</SCRIPT>
<%
if request("xingxing")="class1" then
call add()
response.end
end if
if request("xingxing")="class2" then
call add1()
response.end
end if
if request("xingxing")="del" then
call del()
response.end
end if
%>
<body>
<h1 align="center" class="style1">汇总分类管理</h1>
<p align="center" class="style1"> </p>
<div align="center">
<center>
<table cellspacing=0 cellpadding=0 width=778 bgcolor=#FFCC99 border=1 style="border-collapse: collapse" bordercolor="#3300CC">
<tbody>
<tr>
<td valign=middle align=left width=34> </td>
<td valign=middle align=left width=711>
<%
dim class2,sql,class1,classid,id
Set class1 =Server.CreateObject("ADODB.Recordset")
sql="select * from class1 order by taxis desc"
class1.open sql,conn,1,1
set class2 = Server.CreateObject("ADODB.Recordset")
if not class1.eof then
do while not class1.eof
classid=class1("class1_id")%>
<table width=100%
border=1 cellspacing=1 bordercolor="#111111" bgcolor=#66FF99 style=+"border-collapse: collapse">
<tbody>
<tr>
<td valign=middle align=left bgcolor=#dbdbdb colspan="6" height="20"><font color="#0000FF">一级分类:<%=class1("class1")%><font color="#FF00FF">[排序大小<%=class1("taxis") %>]</font></font> </td>
</tr>
<%
sql="select * from class2 where class1="&classid & " order by taxis desc"
class2.open sql,conn,1
do while not class2.eof
%>
<tr>
<td width="16%" height="25" align=center valign=middle bgcolor=#dbdbdb><%if not class2.eof then%>
<font color="#000000"><%=class2("class2")%></font><font size="-3" color="#FF00FF">[<%=class2("taxis") %>]</font>
<% class2.movenext
end if%>
</td>
<td width="16%" height="25" align=center valign=middle bgcolor=#dbdbdb><%if not class2.eof then%>
<font color="#000000"><%=class2("class2")%></font><font size="-3" color="#FF00FF">[<%=class2("taxis") %>]</font>
<% class2.movenext
end if%>
</td>
<td width="16%" height="25" align=center valign=middle bgcolor=#dbdbdb><%if not class2.eof then%>
<font color="#000000"><%=class2("class2")%></font><font size="-3" color="#FF00FF">[<%=class2("taxis") %>]</font>
<% class2.movenext
end if%>
</td>
<td width="16%" height="25" align=center valign=middle bgcolor=#dbdbdb><%if not class2.eof then%>
<font color="#000000"><%=class2("class2")%></font><font size="-3" color="#FF00FF">[<%=class2("taxis") %>]</font>
<% class2.movenext
end if%>
</td>
<td width="16%" height="25" align=center valign=middle bgcolor=#dbdbdb><%if not class2.eof then%>
<font color="#000000"><%=class2("class2")%></font><font size="-3" color="#FF00FF">[<%=class2("taxis") %>]</font>
<% class2.movenext
end if%>
</td>
<td width="16%" height="25" align=center valign=middle bgcolor=#dbdbdb><%if not class2.eof then%>
<font color="#000000"><%=class2("class2")%></font><font size="-3" color="#FF00FF">[<%=class2("taxis") %>]</font>
<% class2.movenext
end if%>
</td>
</tr>
<%
loop
class2.Close
%>
</tbody>
</table> <table width="710" border="1" bordercolor="#0033FF" bgcolor="#99CCCC">
<tr>
<td width="543" height="31" scope="col" ><form name="addclass2" method="post" action="class_manage.asp?xingxing=class2&class1_id=<%=classid%>">
<span class="style5">增加二级分类:</span>
<input type="text" name="class2" height="15" width="100">
<span class="style6"> 排序值:</span>
<input type="text" name="taxis" height="15" width="100"> <input type="submit" name="Submit" value="提交">
</form></td>
<th width="45" scope="col" > </th>
<th width="52" scope="col" ><a href="classinfo.asp?class1_id=<%=classid%>" class="style1">修改</a></th>
<th width="51" scope="col" ><a href="class_manage.asp?xingxing=del&class1_id=<%=classid%>" class="style1">删除</a></th>
</tr>
</table>
<%
class1.movenext
loop
end if
%>
</td>
<td valign=middle align=left width=25></td>
</tr>
</tbody>
</table>
<p><form name="addclass1" method="POST" action="class_manage.asp?xingxing=class1">
<table width="408" height="68" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF3366" bgcolor="#99CC66" style="border-collapse: collapse">
<tr>
<td height="25" width="404" bgcolor="#FFCC00">
<p align="center">分类总数:<font color="#666666"><b><%=class1.Recordcount%></b></font></td>
</tr>
<tr>
<td width="404" height="21" align="center" style="border-bottom-style: none; border-bottom-width: medium">
<p class="style3">增加大类:<input type="text" name="classtext" size="20" value=""> </p> </td>
</tr>
<tr>
<td width="404" height="25" align="center" style="border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium">
<p class="style3">排序数字:<input type="text" name="taxis" size="20" value="0"></td>
</tr>
<tr>
<td width="404" height="25" style="border-top-style: none; border-top-width: medium">
<p align="center">
<input name="B1" type="submit" value="提交" onClick="checkdata()"></td>
</tr>
</table>
</form></p>
</center>
</div>
</body>
</html>
<%
class1.close
set class1=nothing
set class2=nothing
%>
<%
sub add()
classtext=trim(request("classtext"))
taxis=trim(request("taxis"))
if not isnumeric(taxis) then
response.Write("输入排序值错误!")
response.write "<meta http-equiv=refresh content="&"1;URL=class_manage.asp"">"
response.End()
end if
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [class1] where class1='"&trim(request("classtext"))&"'"
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("class1")=trim(request("classtext"))
rs("taxis")=cint(taxis)
rs.update
response.write "<li>添加大类成功。"
response.write "<meta http-equiv=refresh content=""1;URL=class_manage.asp"">"
rs.close
set rs=nothing
else
response.write "<li>错误,名称已经存在!"
rs.close
set rs=nothing
response.write "<meta http-equiv=refresh content=""2;URL=class_manage.asp"">"
response.end
end if
end sub
sub del()
dim rs,sql1,sql2,id
id=trim(request("class1_id"))
if id="" then
response.write id &"<li>参数错误!"
response.write "<meta http-equiv=refresh content=""1;URL=class_manage.asp"">"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql1="delete from [class1] where class1_id="& id
rs.open sql1,conn,1,3
sql2="delete from [class2] where class1="&id&""
rs.open sql2,conn,1,3
sql="delete from [goods] where class1="&id&""
rs.open sql,conn,1,3
sql="delete from [info] where class1="&id&""
rs.open sql,conn,1,3
response.write "<font size=10>删除大类成功!</font><br>"
response.write "<meta http-equiv=refresh content=""1;URL=class_manage.asp"">"
end sub
sub add1()
class1_id=request("class1_id")
class2=trim(request("class2"))
taxis=trim(request("taxis"))
if class2="" then
response.Write("输入分类名不能为空")
response.write "<meta http-equiv=refresh content=""1;URL=class_manage.asp"">"
response.End()
end if
if not isnumeric(taxis) then
response.Write("输入排序值错误!")
response.write "<meta http-equiv=refresh content=""1;URL=class_manage.asp"">"
response.End()
end if
taxis=cint(taxis)
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [class2] where class1=" & class1_id & " and class2='"&trim(request("class2"))&"'"
rs.open sql,conn,1,3
if rs.eof then
rs.addnew
rs("class1")=class1_id
rs("class2")=trim(request("class2"))
rs("taxis")=trim(request("taxis"))
rs.update
response.write "<li>添加二级分类成功。"
response.write "<meta http-equiv=refresh content=""1;URL=class_manage.asp"">"
rs.close
set rs=nothing
else
response.write "<li>错误,名称已经存在!"
rs.close
set rs=nothing
response.write "<meta http-equiv=refresh content=""2;URL=class_manage.asp"">"
response.end
end if
end sub
closedb
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -