<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="config/db.asp"-->
<!--#include file="config/function.inc.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>新闻分类管理</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
body,table {
font-family: "宋体";
font-size: 12px;
}
-->
</style>
</head>
<body>
<%
dim rst,rst1,rst2,sql,sql1
set rst=server.CreateObject("adodb.recordset")
set rst1=server.CreateObject("adodb.recordset")
set rst2=server.CreateObject("adodb.recordset")
%>
<p>后台新闻分类管理</p>
<p> </p>
<p>新闻分类管理:<a href="admin_newsclass.asp?act=add">填加新闻分类</a></p>
<table width="700" border="1">
<tr bgcolor="#A9C4EB">
<td><div align="center">分类名称</div></td>
<td><div align="center">子分类</div></td>
<td><div align="center">管理</div></td>
<td><div align="center">排序</div></td>
</tr>
<%
sql="select * from tbl_newsclass where nc_upid=0"
rst.open sql,conn,1,1
do while not rst.eof
%>
<tr bgcolor="#DBE3F2">
<td><%=rst("nc_name")%></td>
<td align="center">------</td>
<td><div align="center"><a href="admin_newsclass.asp?act=modify&id=<%=rst("nc_id")%>" >修改</a> <a href="admin_newsclass.asp?act=del&id=<%=rst("nc_id")%>" onClick="javascript:return confirm('您确定要删除此条新闻分类吗');">删除</a></div></td>
<td align="center">
<!-- 用来修改排序字段值 -->
<form name="form1" method="post" action="admin_newsclass.asp?act=sort&id=<%=rst("nc_id")%>">
<label>
<input name="sort" type="text" size="5" value="<%=rst("nc_sort")%>">
</label>
<label>
<input type="submit" name="Submit" value="提交">
</label>
</form>
</td>
</tr>
<%
sql1="select * from tbl_newsclass where nc_upid="&rst("nc_id")
rst1.open sql1,conn,1,1
do while not rst1.eof
%>
<tr>
<td>----></td>
<td><%=rst1("nc_name")%></td>
<td><div align="center"><a href="admin_newsclass.asp?act=modify&id=<%=rst1("nc_id")%>">修改</a> <a href="admin_newsclass.asp?act=del&id=<%=rst1("nc_id")%>" onClick="javascript:return confirm('您确定要删除此条新闻分类吗?');">删除</a></div></td>
<td><div align="center"> <form name="form1" method="post" action="admin_newsclass.asp?act=sort&id=<%=rst1("nc_id")%>">
<label>
<input name="sort" type="text" size="5" value="<%=rst1("nc_sort")%>">
</label>
<label>
<input type="submit" name="Submit" value="提交">
</label>
</form></div></td>
</tr>
<%
rst1.movenext
loop
rst1.close
rst.movenext
loop
rst.close
%>
</table>
<%
if request.QueryString("act")="modify" then
%>
<p>添加新闻分类:</p>
<%
else
%>
<p>修改新闻分类:</p>
<%
end if
%>
<%
taction="admin_newsclass.asp?act=class"
if request.QueryString("act")="modify" then
if not isnumeric(request.QueryString("id")) or isempty(request.QueryString("id")) then
msgboxU "非法参数!"
else
rst.open "select * from tbl_newsclass where nc_id="&request.QueryString("id"),conn,1,1
if rst("nc_upid")=0 then
taction="admin_newsclass.asp?act=update&id="&request.QueryString("id")
else
rst1.open "select * from tbl_newsclass where nc_id="&request.QueryString("id")&" and nc_upid="&rst("nc_id"),conn,1,1
taction="admin_newsclass.asp?act=update&id="&request.QueryString("id")&"&upid="&rst("nc_id")
end if
end if
end if
%>
<form name="form3" method="post" action="<%=taction%>">
<%
if request.QueryString("act")<>"modify" then
%>
<p class="STYLE1">提示:如果没选着上级分类,新增分类将作为顶级分类;如果选着上级分类将作为子分类</p>
<p>请选着上级分类:
<% end if %>
<label>
<select name="upid">
<option value="<%
if request.QueryString("act")="modify" then
response.Write(rst("nc_id"))
else
response.Write("0")
end if
%>" selected>==请选择上级分类==</option>
<%
sql2="select * from tbl_newsclass where nc_upid=0 "
rst2.open sql2,conn,1,1
do while not rst2.eof
%>
<option value="<%=rst2("nc_id")%>"><%=rst2("nc_name")%></option>
<%
rst2.movenext
loop
rst2.close
%>
</select>
</label>
<label>分类名:
<input type="text" name="<%
if request.QueryString("act")="modify" then
response.Write "modify"
else
response.Write "nc_name"
end if
%>" value="<%
if request.QueryString("act")="modify" then
response.Write rst1("nc_name")
end if
%>">
</label>
</p>
<p>
<label>
<input type="submit" name="Submit3" value="提交">
</label>
</p>
</form>
</body>
</html>
上面做了个新闻分类的后台页面
我想实现 显示二级分类时 同时也显示并修改一级分类
只是自己台菜鸟了 才疏学浅, 弄得焦头烂额 最后对象也不知道怎么关了
这代码错在上面地方 怎么修改能实现显示二级分类时 同时也显示并修改一级分类
希望高人指点一下!