28,406
社区成员
发帖
与我相关
我的任务
分享
<!--#include file=conn.asp--><!--换成你的数据库连接文件-->
<%
dim class_1,class_2,class_3,rs
class_1=Request.Form("class_1")
if class_1="" then class_1=0
class_2=Request.Form("class_2")
if class_2="" then class_2=0
class_3=Request.Form("class_3")
if class_3="" then class_3=0
set rs=server.CreateObject("adodb.recordset")
%>
<table border=1>
<form action="换成你的页面.asp" name="form1" method="post">
<tr>
<td colspan="2" align="center" height="30" background="image/tablebg.gif">
<b>新闻发布 </b> </td>
</tr>
<tr valign="middle">
<td width="14%" height="25">新闻类别: </td>
<td width="86%" height="25">
<%
sql="SELECT * FROM News_class WHERE calsslevel=0 ORDER BY orderflag"
rs.Open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
rs.close: set rs=nothing
conn.close: set conn=nothing
response.end
end if
with response
'一级分类选择框
.write("<select name='class_1' onchange='javascript:document.form1.submit();'>")
.write("<option value='0' selected>--请选择一级分类--</option>")
do while not rs.eof
if cint(class_1)=cint(rs(0)) then sel=" selected" else sel=""
.write("<option value='"&rs(0)&"'"&sel&">"&rs(1)&"</option>")
rs.movenext
loop
.Write("</select>")
end with
rs.close
if class_1>0 then'如果选择了一级框
sel=""
'二级分类选择框
sql="SELECT * FROM News_class WHERE calsslevel=1 AND parentID="&class_1&" ORDER BY orderflag"
rs.open sql,conn,1,1
if rs.eof then msg="请添加该栏目的二级分类" else msg="--请选择二级分类--"
with response
.write("<select name='class_2' onchange='javascript:document.form1.submit();'>")
.write("<option value='0' selected>"&msg&"</option>")
do while not rs.eof
if cint(class_2)=cint(rs(0)) then sel=" selected" else sel=""
.write("<option value='"&rs(0)&"'"&sel&">"&rs(1)&"</option>")
rs.movenext
loop
.Write("</select>")
end with
end if
rs.Close
if class_2>0 then'如果选择了二级框
sel=""
'三级分类选择框
sql="SELECT * FROM News_class WHERE calsslevel=2 AND parentID="&class_2&" ORDER BY orderflag"
rs.open sql,conn,1,1
if rs.eof then msg="请添加该栏目的三级分类" else msg="--请选择三级分类--"
with response
.write("<select name='class_3' onchange='javascript:document.form1.submit();'>")
.write("<option value='0' selected>"&msg&"</option>")
do while not rs.eof
if cint(class_3)=cint(rs(0)) then sel=" selected" else sel=""
.write("<option value='"&rs(0)&"'"&sel&">"&rs(1)&"</option>")
rs.movenext
loop
.Write("</select>")
end with
end if
rs.Close: set rs=nothing
conn.close: set conn=nothing
%>
</tr>
</table>