| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1686 人关注过本帖
标题:为什么用ASP编写的二级菜单不能显示啊????????????
只看楼主 加入收藏
z8965600
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-8-16
收藏
 问题点数:0 回复次数:14 
为什么用ASP编写的二级菜单不能显示啊????????????

我写一个关于二级菜单的,数据库的名称:hm.mdb 表的名称是:SmallClass 表里面的字段有: ID , SmallClassID, SmallClassType, BigClassName, SmallClassName, SmallClassMaster
现在程序代码如下,请大家帮我检查一下,怎么不能显示二级菜单(SmallClassName的值):

1.admin_Newsadd1.asp


<%pagename="admin_newsadd"%>
<!--#include file="session.asp"-->
<%checkadmin1%>
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="top.asp"-->

<table border="1" width="755" cellspacing="0" cellpadding="1" bgcolor="<%=mainbgcolor%>">
<tr>
<td valign=top width=20%><!--#include file="admin_left.asp"--></td>
<td valign=top>
<form method="post" action="admin_newsadd2.asp">
<table border="1" width="100%" cellspacing="0" cellpadding="0" class="tableline" bordercolorlight="<%=mainbcolor%>" bgcolor="<%=mainccolor%>">
<tr>
<td width="100%" height="20" colspan=2 align=center bgcolor="<%=maintcolor%>"><b>增 加 新 闻</b></td>
</tr>
<tr>
<td align="center">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>
<%
sql="select * from bigclass order by bigclassid"
rs.open sql,conn,1,1
%>
<select name="bigclassname" size="1" onChange="window.open('admin_newsadd1.asp?bigclassname='+this.options[this.selectedindex].value,'_self')">
<option value="" <%if request("bigclassname")="" then%> selected<%end if%>>选择大类</option>
<%
''111111111111111111111111111111111111111111111111111111111111111111111111111111
if session("key")="super" or session("key")="senior" then '如果是高级以上管理员
while not rs.eof
%>
<option<%if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then%> selected<%end if%> value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
rs.movenext
wend
else
while not rs.eof
if instr(rs("bigclassmaster"),session("username"))<>0 then '如果是大类管理员
%>
<option<%if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then%> selected<%end if%> value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
end if
set rs1=server.createobject ("adodb.recordset") '如果小类有这个大类管理员
sql1="select * from smallclass where bigclassname='"& rs("bigclassname") & "' and instr(smallclassmaster,'"&session("username")&"')<>0"
rs1.open sql1,conn,1,1
if not rs1.eof then
%>
<option<%if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then%> selected<%end if%> value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
end if
rs1.close
set rs1=nothing
rs.movenext
wend
end if

%>
</select>
<%
if request("bigclassname")<>"" then%>
<select name="smallclassid" size="1">
<option value="" <%if request("smallclassid")="" then%> selected<%end if%>>选择小类</option>
<%
set trs=server.createobject("adodb.recordset")
if session("key")="inter" then
set rs1=server.createobject("adodb.recordset")
sql1="select bigclassmaster from bigclass where bigclassname='"&request("bigclassname")&"'"
rs1.open sql1,conn,1,1
if instr(rs1("bigclassmaster"),session("username"))<>0 then
sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' order by smallclassid"
else
sql="select * from smallclass where instr(smallclassmaster,'"&session("username")&"')<>0 and bigclassname='"&request("bigclassname")&"' order by smallclassid"
end if
rs1.close
set rs1=nothing
end if

if session("key")="super" or session("key")="senior" then sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' order by smallclassid"
if session("key")="input" or session("key")="check" then sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' and instr(smallclassmaster,'"&session("username")&"')<>0 order by smallclassid"
trs.open sql,conn,1,1
do while not trs.eof
%>
<option<%if cstr(request("smallclassid"))=cstr(trs("smallclassid")) and request("smallclassid")<>"" then%> selected<%end if%> value="<%=cstr(trs("smallclassid"))%>" name=smallclassid><%=trs("smallclassname")%></option>
<%
trs.movenext
loop
trs.close
%>
<%else%>
<select name="smallclassid" size="1">
<option value="" selected>选择小类</option>
<%end if%>
</select>
</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
</td>
</tr>
<tr>
<td align="center" height="25">

<input type="submit" value=" 确 定 " name="cmdok">

</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<%rs.close
set trs=nothing
set rs=nothing%>
<!--#include file="copyright.asp"-->

2.admin_Newsadd2.asp

<%pagename="admin_newsadd2"%>
<!--#include file="session.asp"-->
<%checkadmin1%>
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="top.asp"-->
<%
bigclassname=request.form("bigclassname")
if bigclassname="" then
%>
<script language=javascript>
history.back()
alert("请选择新闻大类!如果没有请添加!")
</script>
<%
response.end
end if

smallclassid=request.form("smallclassid")
if smallclassid="" then
%>
<script language=javascript>
history.back()
alert("请选择新闻小类!如果没有请添加!")
</script>
<%
response.end
end if
%>
<script language="javascript">
<!--
function checkform()
{
if (document.form1.txttitle.value.length == 0) {
alert("请输入文章标题.");
document.form1.txttitle.focus();
return false;
}
if (document.form1.about.value.length == 0) {
alert("请输入关键词.");
document.form1.about.focus();
return false;
}
document.form1.content.value=document.form1.doc_html.value;

return true
}
//-->
</script>
<table border="1" width="755" cellspacing="0" cellpadding="1" bgcolor="<%=mainbgcolor%>">
<tr>
<td valign=top>
<form method="post" action="admin_newsadd3.asp" name="form1" onSubmit="return checkform()">
<table border="0" cellspacing="0" width="100%" bordercolorlight="#000000" bordercolordark="#ffffff" cellpadding="0" bgcolor="#000000">
<tr align="center">
<td width="100%">
<table border="0" cellspacing="1" width="100%" cellpadding="3">
<tr align="center">
<td height="20" colspan=2 align=center bgcolor="<%=maintcolor%>"><b>添
加 新 闻</b> &nbsp;</td>
</tr>
<tr>
<td width="14%" align="right" class="unnamed2" valign="middle" bgcolor="#ffffff">所属大类:</td>
<input type=hidden name="bigclassname" value='<%=bigclassname%>'>
<td bgcolor="#ffffff">&nbsp;&nbsp;<%=bigclassname%></td>
</tr>
<tr>
<td width="14%" align="right" class="unnamed2" valign="middle" bgcolor="#ffffff">&nbsp;所属小类:</td>
<td bgcolor="#ffffff">&nbsp;
<%

sql="select smallclassname from smallclass where smallclassid="&smallclassid
rs.open sql,conn,1,1
if not rs.eof then
smallclassname=rs("smallclassname")
end if
rs.close
%>
<%=smallclassname%>
<input type=hidden name="smallclassname" value='<%=smallclassname%>'>
</td>
</tr>
<!--新加入阅读权限beg-->
<tr>
<td width="14%" align="right" class="unnamed2" valign="middle" bgcolor="#ffffff"><font color="#ff0000">*</font> 阅读权限:</td>
<td bgcolor="#ffffff"> &nbsp;
<select name="userlevel" size="1">
<option value="0" selected>无要求</option>
<%
set rs1=server.createobject("adodb.recordset")
sql1="select * from usergrade order by id"
rs1.open sql1,conn,1,1
while not rs1.eof
%>
<option value="<%=rs1("id")%>"><%=rs1("userlevel")%></option>
<% rs1.movenext
wend
rs1.close
set rs1=nothing
%>
</select>
</td>
</tr>
<!--新加入阅读权限end-->


<tr>
<td width="14%" align="right" class="unnamed2" valign="middle" bgcolor="#ffffff">所属专题:</td>
<td bgcolor="#ffffff"> &nbsp;
<select name="specialname" size="1">
<%

sql="select * from special order by specialid"
rs.open sql,conn,1,1
%>
<option value="无">不属于任何专题</option>
<%if rs.eof then %>
<option value="无" selected>暂无任何专题</option>
<%else
while not rs.eof
%>
<option value="<%=rs("specialname")%>"><%=rs("specialname")%></option>
<%
rs.movenext
wend
end if
rs.close
%>
</select>
</td>
</tr>
<tr>
<td width="14%" align="right" class="unnamed2" valign="middle" bgcolor="#ffffff"><font color="#ff0000">*</font>&nbsp;新闻标题:</td>
<td bgcolor="#ffffff"> <span style='cursor:hand' title='缩短对话框' onclick='if (me.size>10)me.size=me.size-2'>-</span>
<input name="txttitle" id=me type="text" size=60 maxlength=100 style="background-color:ffffff;color:000000;border: 1 double">
<span style='cursor:hand' title='加长对话框' onclick='if (me.size<102)me.size=me.size+2'>+</span>
</td>
</tr>
<tr>
<td width="14%" align="right" class="unnamed2" valign="middle" bgcolor="#ffffff">新闻来源:</td>
<td bgcolor="#ffffff"> <span style='cursor:hand' title='缩短对话框' onclick='if (message.size>10)message.size=message.size-2'>-</span>
<input name="original" id=message type="text" size=30 maxlength=100 style="background-color:ffffff;color:000000;border: 1 double" value="<%=webname%>">
<span style='cursor:hand' title='加长对话框' onclick='if (message.size<102)message.size=message.size+2'>+</span>
</td>
</tr>
<tr>
<td width="14%" align="right" class="unnamed2" valign="middle" bgcolor="#ffffff">新闻作者:</td>
<td bgcolor="#ffffff"><span style='cursor:hand' title='缩短对话框' onclick='if (mess.size>10)mess.size=mess.size-2'>-</span>
<input name="author" id=mess type="text" size=30 maxlength=100 style="background-color:ffffff;color:000000;border: 1 double">
<span style='cursor:hand' title='加长对话框' onclick='if (mess.size<102)mess.size=mess.size+2'>+</span>
</td>
</tr>
<tr>
<td width="14%" align="right" bgcolor="#ffffff">新闻模版:</td>
<td bgcolor="#ffffff"> &nbsp;
<select name="model">
<option value="0">默认模版</option>
<option value="1">新闻模版一</option>
<option value="2">新闻模版二</option>
</select>
</td>
</tr>
<tr>
<td width="14%" align="right" valign="top" class="unnamed2" bgcolor="#ffffff"><font color="#ff0000">*</font>&nbsp;新闻内容:</td>
<td bgcolor="menu"><object id=doc_html style="left: 0px; top: 0px" data=editor.html width=544 height=320 type=text/x-scriptlet viewastext>
</object>
<input type="hidden" name="content" value="" >
</td>
</tr>
<tr>
<td width="14%" align="right" class="unnamed2" valign="middle" bgcolor="#ffffff"><font color="#ff0000">*</font>&nbsp;相关新闻:</td>
<td bgcolor="#ffffff"><span style='cursor:hand' title='缩短对话框' onclick='if (ss.size>10)ss.size=ss.size-2'>-</span>
<input name="about" id=ss type="text" size=30 maxlength=100 style="background-color:ffffff;color:000000;border: 1 double">
<span style='cursor:hand' title='加长对话框' onclick='if (ss.size<102)ss.size=ss.size+2'>+</span>
填入关键字或完整标题 </td>
</tr>
<tr>
<td width="14%" align="right" valign="middle" class="unnamed2" bgcolor="#ffffff">新闻性质:</td>
<td valign="middle" bgcolor="#ffffff">&nbsp; 焦点新闻:
<input type="checkbox" name="focusnews">
推荐新闻:
<input type="checkbox" name="goodnews">
热点新闻:
<input type="checkbox" name="hot">
<%if session("key")<>"input" then%>
新闻固顶:
<input type="checkbox" name="ontop">
<%end if%>
</td>
</tr>
<%if opencheck=true then
if session("key")<>"input" then%>
<tr>
<td width="14%" align="right" bgcolor="#ffffff">通过审核:</td>
<td bgcolor="#ffffff"> &nbsp;
<input type="checkbox" name="checked">
</td>
</tr>
<%end if
else%>
<tr>
<td width="14%" align="right" bgcolor="#ffffff">通过审核:</td>
<td bgcolor="#ffffff"> &nbsp;
<input type="checkbox" name="checked" checked>
</td>
</tr>
<%end if%>
<tr>
<td width="14%" align="right" bgcolor="#ffffff">图片张数:</td>
<td bgcolor="#ffffff" valign="middle"> &nbsp;
<input name="image" type="text" size=2 maxlength=2 style="background-color:ffffff;color:000000;border: 1 double" value=0>
指直接使用编辑器插入代码的图片总数(即序号&quot;n&quot;值)</td>
</tr>
<tr>
<td width="14%" align="right" bgcolor="#ffffff">发布时间:</td>
<td bgcolor="#ffffff"> &nbsp;
<input name="updatetime" type="text" size=20 maxlength=20 style="background-color:ffffff;color:000000;border: 1 double" value="<%=now()%>">
&nbsp;当前时间为:<%=now()%> 注意不要改变格式。</td>
</tr>
<tr>
<td height="25" colspan=2 align="center" bgcolor="#ffffff">
<font color="#ff0000">注意:当下栏可视化编辑器出现图标显示不全的问题,请重新进入,否则保存后内容会消失。</font></td>
</tr>
<tr>
<td height="20" colspan=2 align=center bgcolor="#ffffff">
<input type="submit" value=" 添 加 "
name="cmdok" class="unnamed5">
&nbsp;
<input type="reset" value=" 清 除 "
name="cmdcancel" class="unnamed5">
&nbsp;
<input type="button" name="ok" value=" 放 弃 " onClick="javascript:history.go(-1)">
&nbsp;&nbsp;<input type="button" value="计算字数" onClick="alert('本篇文章共'+document.form1.doc_html.value.length+'字节')" name="submit1">
</td>
</tr>
</table>

</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<%set rs=nothing%>
<!--#include file="copyright.asp"-->


当admin_Newsadd1.asp执行完后转到admin_Newsadd2.asp中时,会提示"请选择新闻小类!如果没有请添加!",请各位大侠帮我看看这是怎么回事啊???

我的QQ: 279490384 邮箱:ze119@163.com

搜索更多相关主题的帖子: 菜单 数据库 ASP include 
2007-08-16 17:54
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
就这个事情?
2007-08-16 18:30
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

<%pagename="admin_newsadd"%>
<!--#include file="session.asp"-->
<%checkadmin1%>
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="top.asp"-->

<table border="1" width="755" cellspacing="0" cellpadding="1" bgcolor="<%=mainbgcolor%>">
<tr>
<td valign=top width=20%><!--#include file="admin_left.asp"--></td>
<td valign=top>
<form method="post" action="admin_newsadd2.asp">
<table border="1" width="100%" cellspacing="0" cellpadding="0" class="tableline" bordercolorlight="<%=mainbcolor%>" bgcolor="<%=mainccolor%>">
<tr>
<td width="100%" height="20" colspan=2 align=center bgcolor="<%=maintcolor%>"><b>增 加 新 闻</b></td>
</tr>
<tr>
<td align="center">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>
<%
sql="select * from bigclass order by bigclassid"
rs.open sql,conn,1,1
%>
<select name="bigclassname" size="1" onChange="window.open('admin_newsadd1.asp?bigclassname='+this.options[this.selectedindex].value,'_self')">
<option value=""
<%
if request("bigclassname")="" then
%> selected
<%end if%>>选择大类</option>
<%
if session("key")="super" or session("key")="senior" then '如果是高级以上管理员
while not rs.eof
%>
<option
<%
if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then
%>
selected
<%end if%>
value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
rs.movenext
wend
else
while not rs.eof
if instr(rs("bigclassmaster"),session("username"))<>0 then '如果是大类管理员
%>
<option
<%
if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then
%>
selected
<%end if%> value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
end if
set rs1=server.createobject ("adodb.recordset") '如果小类有这个大类管理员
sql1="select * from smallclass where bigclassname='"& rs("bigclassname") & "' and instr(smallclassmaster,'"&session("username")&"')<>0"
rs1.open sql1,conn,1,1
if not rs1.eof then
%>
<option
<%
if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then
%>
selected
<%end if%> value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
end if
rs1.close
set rs1=nothing
rs.movenext
wend
end if

%>
</select>
<%
if request("bigclassname")<>"" then%>
<select name="smallclassid" size="1">
<option value=""
<%
if request("smallclassid")="" then
%> selected
<% end if%>>选择小类</option>
<%
set trs=server.createobject("adodb.recordset")
if session("key")="inter" then
set rs1=server.createobject("adodb.recordset")
sql1="select bigclassmaster from bigclass where bigclassname='"&request("bigclassname")&"'"
rs1.open sql1,conn,1,1
if instr(rs1("bigclassmaster"),session("username"))<>0 then
sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' order by smallclassid"
else
sql="select * from smallclass where instr(smallclassmaster,'"&session("username")&"')<>0 and bigclassname='"&request("bigclassname")&"' order by smallclassid"
end if
rs1.close
set rs1=nothing
end if

if session("key")="super" or session("key")="senior" then
sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' order by smallclassid"
if session("key")="input" or session("key")="check" then
sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' and instr(smallclassmaster,'"&session("username")&"')<>0 order by smallclassid"
trs.open sql,conn,1,1
do while not trs.eof
%>
<option<%
if cstr(request("smallclassid"))=cstr(trs("smallclassid")) and request("smallclassid")<>"" then%> selected
<%end if%> value="<%=cstr(trs("smallclassid"))%>" name=smallclassid><%=trs("smallclassname")%></option>
<%
trs.movenext
loop
trs.close
%>
<%else%>
<select name="smallclassid" size="1">
<option value="" selected>选择小类</option>
<%end if%>
</select>
</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
</td>
</tr>
<tr>
<td align="center" height="25">

<input type="submit" value=" 确 定 " name="cmdok">

</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<%
rs.close
set trs=nothing
set rs=nothing%>
<!--#include file="copyright.asp"-->

虽然还没看出来楼主那里写错了,不过我想说楼主写的代码实在是够乱,个人认为写代码跟写字一样,养成字迹工整的习惯也很重要的。

2007-08-16 19:08
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
smallclassid=request.form("smallclassid")
这句话是从哪里提交过来的表单?

2007-08-16 19:11
z8965600
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-8-16
收藏
得分:0 

谢谢4楼的兄弟啊,能否加我QQ啊.我们进一步探讨啊.

那个语句应该和<%bigclassname=request.form("bigclassname")这一句意思是一样的啊.
<%
response.end
end if 这儿是不是少了个 %>

这儿加一个<%
smallclassid=request.form("smallclassid")
if smallclassid="" then
%>
<script language=javascript>
history.back()
alert("请选择新闻小类!如果没有请添加!")
</script>


努力学习ASP!!
2007-08-16 20:42
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
smallclassid=request.form("smallclassid")
根据楼主说的错误,明显这句话没有得到值,所以程序执行了if语句内的代码
<form method="post" action="admin_newsadd3.asp" name="form1" onSubmit="return checkform()">
还有就是楼主给的第二个网页文件名为admin_newsadd2.asp,而admin_newsadd1.asp中表单action="admin_newsadd3.asp"
接下来admin_Newsadd2.asp里出现了smallclassid=request.form("smallclassid")
这个代码。因此我很想知道楼主的admin_newsadd1.asp是如何转到admin_newsadd2.asp的?
2007-08-16 21:26
z8965600
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-8-16
收藏
得分:0 
回复:(z8965600)谢谢4楼的兄弟啊,能否加我QQ啊.我们...

请教兄弟,怎么改才能得到它的值啊?

smallclassid=request.form("smallclassid")



兄弟提到这一句:<form method="post" action="admin_newsadd3.asp" name="form1" onSubmit="return checkform()">
这一句是第二个网页文件名中的,当在admin_newsadd2.asp中把要添加的信息输入完后,点击“添加”,表单就将值传到admin_newsadd3.asp中,而admin_newsadd3.asp的内容如下:

<!--#include file="session.asp"-->
<%checkadmin1%>
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<%
founderr=false
function changechr(str)
changechr=replace(replace(replace(replace(str,"<","&lt;"),">","&gt;"),chr(13),"<br>")," "," ")
changechr=replace(changechr,"'","&quot;")
changechr=replace(changechr,mid(" "" ",2,1),"&quot;")
end function


smallclassname=request.form("smallclassname")
txttitle=request.form("txttitle")
if len(txttitle)>100 then
errmsg=errmsg+"<br>"+"<li>新闻标题过长!限定100个字符。"
founderr=true
end if

title=changechr(trim(request.form("txttitle")))
author=replace(trim(request.form("author")),"'","''")
if len(author)>20 then
errmsg=errmsg+"<br>"+"<li>新闻作者过长!限定20个字符。"
founderr=true
end if

original=replace(trim(request.form("original")),"'","''")
if len(original)>20 then
errmsg=errmsg+"<br>"+"<li>新闻来源过长!限定20个字符。"
founderr=true
end if

content=request.form("content")
if content="" then
errmsg=errmsg+"<br>"+"<li>没有输入新闻内容。"
founderr=true
end if

if not isnumeric(request.form("image")) or isempty(request.form("image")) or request.form("image")=<0 then
image=0
else
image=request.form("image")
end if

if image>0 then
for i=1 to image
if instr(content,"[[image"&i&"]]")=0 then
errmsg=errmsg+"<br>"+"<li>没有加入图片代码:[[image"&i&"]]。"
founderr=true
end if
next
end if

focusnews=request.form("focusnews")
if isempty(focusnews) then
focusnews=false
else
focusnews=true
end if

goodnews=request.form("goodnews")
if isempty(goodnews) then
goodnews=false
else
goodnews=true
end if

hot=request.form("hot")
if isempty(hot) then
hot=false
else
hot=true
end if

if opencheck=true then
checked=request.form("checked")
if isempty(checked) then
checked=false
else
checked=true
end if
else
checked=true
end if

if opencheck=false then
checked=true
end if

ontop=request.form("ontop")
if isempty(ontop) then
ontop=false
else
ontop=true
end if

if founderr=true then
call error()
else

sql="select * from news"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("author")=author
rs("content")=content
rs("original")=original
rs("userlevel")=request.form("userlevel")
rs("image")=image
rs("focusnews")=focusnews
rs("goodnews")=goodnews
rs("hot")=hot
rs("checked")=checked
rs("ontop")=ontop
rs("model")=request.form("model")
rs("bigclassname")=request.form("bigclassname")
rs("smallclassname")=request.form("smallclassname")
rs("specialname")=request.form("specialname")
rs("about")=request.form("about")
rs("updatetime")=request.form("updatetime")
rs("username")=session("username")
rs("loginip")=request.servervariables("remote_addr")
rs.update

if image=0 then
response.redirect "admin_newsadd1.asp"
else
if uploadflag=0 then response.redirect "admin_newsadd1.asp"
if uploadflag=1 then response.redirect "admin_uploadselect.asp?newsid=" & rs("newsid")&"&image="&image
if uploadflag=2 then response.redirect "admin_uploadimgselect.asp?newsid=" & rs("newsid")&"&image="&image
end if

rs.close
end if
set rs=nothing
conn.close
set conn=nothing
%>

当在级联菜单中选择“大类”和“小类”,点击“确定”后,就会转到第二个页面。
admin_newsadd1.asp中有一句这个:
<form method="post" action="admin_newsadd2.asp">和
<input type="submit" value=" 确 定 " name="cmdok">这一句

再烦请兄弟看看啊。 谢谢!!我的QQ:279490384


努力学习ASP!!
2007-08-16 22:45
ayue222
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:341
专家分:0
注 册:2007-7-25
收藏
得分:0 
.......看得偶头昏眼花脚抽筋...
2007-08-17 10:00
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

1.admin_Newsadd1.asp


<%pagename="admin_newsadd"%>
<!--#include file="session.asp"-->
<%checkadmin1%>
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="top.asp"-->

<script language="javascript">
function smlcls_Change(val)
{
document.form1.smallclassid.value=val;
}
</script>

<table border="1" width="755" cellspacing="0" cellpadding="1" bgcolor="<%=mainbgcolor%>">
<tr>
<td valign=top width=20%><!--#include file="admin_left.asp"--></td>
<td valign=top>
<form name="form1" method="post" action="admin_newsadd2.asp">
<table border="1" width="100%" cellspacing="0" cellpadding="0" class="tableline" bordercolorlight="<%=mainbcolor%>" bgcolor="<%=mainccolor%>">
<tr>
<td width="100%" height="20" colspan=2 align=center bgcolor="<%=maintcolor%>"><b>增 加 新 闻</b></td>
</tr>
<tr>
<td align="center">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>
<%
sql="select * from bigclass order by bigclassid"
rs.open sql,conn,1,1
%>
<select name="bigclassname" size="1" onChange="window.open('admin_newsadd1.asp?bigclassname='+this.options[this.selectedindex].value,'_self')">
<option value="" <%if request("bigclassname")="" then%> selected<%end if%>>选择大类</option>
<%
''111111111111111111111111111111111111111111111111111111111111111111111111111111
if session("key")="super" or session("key")="senior" then '如果是高级以上管理员
while not rs.eof
%>
<option<%if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then%> selected<%end if%> value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
rs.movenext
wend
else
while not rs.eof
if instr(rs("bigclassmaster"),session("username"))<>0 then '如果是大类管理员
%>
<option<%if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then%> selected<%end if%> value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
end if
set rs1=server.createobject ("adodb.recordset") '如果小类有这个大类管理员
sql1="select * from smallclass where bigclassname='"& rs("bigclassname") & "' and instr(smallclassmaster,'"&session("username")&"')<>0"
rs1.open sql1,conn,1,1
if not rs1.eof then
%>
<option<%if request("bigclassname")=rs("bigclassname") and request("bigclassname")<>"" then%> selected<%end if%> value="<%=rs("bigclassname")%>" name=bigclassname><%=rs("bigclassname")%></option>
<%
end if
rs1.close
set rs1=nothing
rs.movenext
wend
end if

%>
</select>
<%
if request("bigclassname")<>"" then%>
<select name="smlclsid" onChange="smlcls_Change(this.options[this.selectedIndex].value);" size="1">
<option value="" <%if request("smallclassid")="" then%> selected<%end if%>>选择小类</option>
<%
set trs=server.createobject("adodb.recordset")
if session("key")="inter" then
set rs1=server.createobject("adodb.recordset")
sql1="select bigclassmaster from bigclass where bigclassname='"&request("bigclassname")&"'"
rs1.open sql1,conn,1,1
if instr(rs1("bigclassmaster"),session("username"))<>0 then
sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' order by smallclassid"
else
sql="select * from smallclass where instr(smallclassmaster,'"&session("username")&"')<>0 and bigclassname='"&request("bigclassname")&"' order by smallclassid"
end if
rs1.close
set rs1=nothing
end if

if session("key")="super" or session("key")="senior" then sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' order by smallclassid"
if session("key")="input" or session("key")="check" then sql="select * from smallclass where bigclassname='"&request("bigclassname")&"' and instr(smallclassmaster,'"&session("username")&"')<>0 order by smallclassid"
trs.open sql,conn,1,1
do while not trs.eof
%>
<option<%if cstr(request("smallclassid"))=cstr(trs("smallclassid")) and request("smallclassid")<>"" then%> selected<%end if%> value="<%=cstr(trs("smallclassid"))%>" name=smallclassid><%=trs("smallclassname")%></option>
<%
trs.movenext
loop
trs.close
%>
<%else%>
<select name="smallclsid" onChange="smlcls_Change(this.options[this.selectedIndex].value);" size="1">
<option value="" selected>选择小类</option>
<%end if%>
</select>
<input name="smallclassid" type="hidden" >
</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
</td>
</tr>
<tr>
<td align="center" height="25">

<input type="submit" value=" 确 定 " name="cmdok">

</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<%rs.close
set trs=nothing
set rs=nothing%>
<!--#include file="copyright.asp"-->

这样试试。

2007-08-17 19:38
z8965600
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-8-16
收藏
得分:0 
回复:(ayue222).......看得偶头昏眼花脚抽筋...

兄弟,我现在有个这个想法,你看对不啊?



就是二级菜单选择的时候不能显示选项是不是因为数据库的读取有问题啊.

也就是说二级菜单在读数据库的时候没有读到有值.因此才不能显示选项.


你认为呢???


努力学习ASP!!
2007-08-17 23:49
快速回复:为什么用ASP编写的二级菜单不能显示啊????????????
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040954 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved