注册 登录
编程论坛 ASP技术论坛

为什么用ASP编写的二级菜单不能显示啊????????????

z8965600 发布于 2007-08-16 17:54, 1686 次点击

我写一个关于二级菜单的,数据库的名称: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

14 回复
#2
multiple19022007-08-16 18:30
就这个事情?
#3
yms1232007-08-16 19:08

<%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"-->

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

#4
yms1232007-08-16 19:11
smallclassid=request.form("smallclassid")
这句话是从哪里提交过来的表单?

#5
z89656002007-08-16 20:42

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

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

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

#6
yms1232007-08-16 21:26
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的?
#7
z89656002007-08-16 22:45
回复:(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

#8
ayue2222007-08-17 10:00
.......看得偶头昏眼花脚抽筋...
#9
yms1232007-08-17 19:38

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"-->

这样试试。

#10
z89656002007-08-17 23:49
回复:(ayue222).......看得偶头昏眼花脚抽筋...

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



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

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


你认为呢???

#11
yms1232007-08-18 17:00

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>
<%
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 "
sql=sql&" instr(smallclassmaster,'"&session("username")&"')<>0 and "
sql=sql&"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 "
sql=sql&"bigclassname='"&request("bigclassname")&"' and "
sql=sql&"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"-->

小类显示不出来跟红字的代码应该有关系,那个查询的问题,个人觉得楼主的代码逻辑上过于混乱。像这种问题着重使用javascript比着重使用服务器端代码要好。

#12
yms1232007-08-18 17:15
我很早以前写的二级联动源代码,里面用的是省市联动
选择省份第二个列表框显示相应的城市
[CODE]<!--#include file="UserControl.asp"-->
<!--#include file="Cls\WebSiteSetInf.asp"-->
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<%
'网页样式初始化代码
Dim PageStyleT
Dim oWebI
Set oWebI=New WebSetInf
Set PageStyleT=New PageStyle
Call QueryStyle("真实资料修改",PageStyleT)
%>
<TITLE><%=oWebI.WebName%>-真实资料修改</TITLE>
<style type="text/css">
<!--
<%=PageStyleT.StyleString%>
-->
</style>
<STYLE type=text/css>
<!--
body {
background-color: <%=PageStyleT.BackGround%>;
}
.style4 {font-size: 14px}
.style5 {font-size: 12px}
-->
</STYLE>
<%
'网页初始化区域
Dim UsR
Dim ControlR
Dim UsName
Dim rsRe
Set UsR=New User
Set ControlR=New UserControl
IF Session("UserName")<>"" Then
UsName=Session("UserName")
Else
Response.Redirect "ErrPage.asp?ErrorMessage=您还没有登录请先登陆"
End IF
ControlR.Initialize
ControlR.ReturnReaInformation UsName,UsR
ControlR.ReturnWebSiteInformation UsName,UsR
ControlR.ReturnBasicInformation UsName,UsR
UsR.UserBirthday=ControlR.RuturnBirthday(UsName)
UsR.UserSex=ControlR.RuturnSex(UsName)
%>
<script language="javascript">
//声明信息储存变量
var UserRealName;
var UserNation;
var UserProvince;
var UserCity;
var UserJob;
var UserEdu;
var UserBlood;
var UserZodiac;
var UserBelieve;
var UserPhone;
var UserMailAddress;
var UserBiref;
//网页初始化函数
function PageInit()
{
document.fUserBiref.UserBiref.value=document.fUserBiref.bValue.value;
<%
'服务器端输入有效性验证代码'
Dim ReFalse
ReFalse="T"
IF Request.Form("IsSubmit")="T" Then
'//TODO:服务器端有效性验证代码'
IF Request.Form("UserRealName")="" Then
Response.Write("alert("&"""真实姓名为空"""&");")
ReFalse="F"
End IF
IF ReFalse<>"F" Then
IF Len(Request.Form("UserRealName"))>10 Then
Response.Write("alert("&"""真实姓名长度过大,注:最大10个字符"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserNation")="" Then
Response.Write("alert("&"""国家为空"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Len(Request.Form("UserNation"))>10 Then
Response.Write("alert("&"""国家长度过大,注:最大10个字符"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserProvince")="" Then
Response.Write("alert("&"""省份为空"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Len(Request.Form("UserProvince"))>10 Then
Response.Write("alert("&"""省份长度过大,注:最大10个字符"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserCity")="" Then
Response.Write("alert("&"""城市为空"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Len(Request.Form("UserCity"))>10 Then
Response.Write("alert("&"""城市长度过大,注:最大10个字符"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserJob")="" Then
Response.Write("alert("&"""职业为空"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Len(Request.Form("UserJob"))>50 Then
Response.Write("alert("&"""职业长度过大,注:最大50个字符"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserEdu")="" Then
Response.Write("alert("&"""学历为空"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Len(Request.Form("UserEdu"))>50 Then
Response.Write("alert("&"""学历长度过大,注:最大50个字符"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserBlood")="" Then
Response.Write("alert("&"""血型为空"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Len(Request.Form("UserBlood"))>7 Then
Response.Write("alert("&"""血型长度过大,注:最大7个字符"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserBelieve")="" Then
Response.Write("alert("&"""信仰为空"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Len(Request.Form("UserJob"))>50 Then
Response.Write("alert("&"""信仰长度过大,注:最大50个字符"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserPhone")="" Then
Response.Write("alert("&"""电话为空"""&");")
ReFalse="F"
Else
IF ReFalse<>"F" Then
On Error Resume Next
IF VarType(CDbl(Request.Form("UserPhone")))<>5 Then
Response.Write("alert("&"""电话非数字"""&");")
ReFalse="F"
End IF
End IF
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserMailAddress")="" Then
Response.Write("alert("&"""通讯地址为空"""&");")
ReFalse="F"
End IF
End IF
IF ReFalse<>"F" Then
IF Request.Form("UserBiref")<>"" Then
IF Len(Request.Form("UserBiref"))>300 Then
Response.Write("alert("&"""签名长度大于300个字"""&");")
ReFalse="F"
End IF
End IF
End IF
IF ReFalse<>"F" Then
UsR.UserRealName=Request.Form("UserRealName")
UsR.UserNation=Request.Form("UserNation")
UsR.UserProvince=Request.Form("UserProvince")
UsR.UserCity=Request.Form("UserCity")
UsR.UserJob=Request.Form("UserJob")
UsR.UserEdu=Request.Form("UserEdu")
UsR.UserZodiac=Request.Form("UserZodiac")
UsR.UserBlood=Request.Form("UserBlood")
UsR.UserBelieve=Request.Form("UserBelieve")
UsR.UserPhone=Request.Form("UserPhone")
UsR.UserMailAdderss=Request.Form("UserMailAddress")
UsR.UserBiref=Request.Form("UserBiref")
Set rsRe=Server.CreateObject("ADODB.RecordSet")
rsRe.Open "UserReal",con,1,3
Do Until rsRe.EOF
IF rsRe.Fields(1).value=UsR.UserName Then
Exit Do
End IF
rsRe.MoveNext
Loop
IF rsRe.EOF=True Then
Dim SQLInst
SQLInst="INSERT INTO UserReal VALUES("
SQLInst=SQLInst&UsR.UserID&","
SQLInst=SQLInst&"'"&UsR.UserName&"',"
SQLInst=SQLInst&"'"&UsR.UserRealName&"',"
SQLInst=SQLInst&"'"&UsR.UserNation&"',"
SQLInst=SQLInst&"'"&UsR.UserProvince&"',"
SQLInst=SQLInst&"'"&UsR.UserCity&"',"
SQLInst=SQLInst&"'"&UsR.UserJob&"',"
SQLInst=SQLInst&"'"&UsR.UserEdu&"',"
SQLInst=SQLInst&"'"&UsR.UserZodiac&"',"
SQLInst=SQLInst&"'"&UsR.UserBlood&"',"
SQLInst=SQLInst&"'"&UsR.UserBelieve&"',"
SQLInst=SQLInst&UsR.UserPhone&","
SQLInst=SQLInst&"'"&UsR.UserMailAdderss&"',"
SQLInst=SQLInst&"'"&UsR.UserBiref&"'"
SQLInst=SQLInst&")"
Response.Write "//"&SQLInst&Chr(13)
con.Execute SQLInst
Else
Dim SQLUpdate
SQLUpdate="UPDATE UserReal SET "
SQLUpdate=SQLUpdate&"UserRealityName='"&UsR.UserRealName&"',"
SQLUpdate=SQLUpdate&"UserNation='"&UsR.UserNation&"',"
SQLUpdate=SQLUpdate&"UserPro='"&UsR.UserProvince&"',"
SQLUpdate=SQLUpdate&"UserCity='"&UsR.UserCity&"',"
SQLUpdate=SQLUpdate&"UserJob='"&UsR.UserJob&"',"
SQLUpdate=SQLUpdate&"UserEdu='"&UsR.UserEdu&"',"
SQLUpdate=SQLUpdate&"UserZodiac='"&UsR.UserZodiac&"',"
SQLUpdate=SQLUpdate&"UserBlood='"&UsR.UserBlood&"',"
SQLUpdate=SQLUpdate&"UserBelieve='"&UsR.UserBelieve&"',"
SQLUpdate=SQLUpdate&"UserPhone="&UsR.UserPhone&","
SQLUpdate=SQLUpdate&"UserMailAdderss='"&UsR.UserMailAdderss&"',"
SQLUpdate=SQLUpdate&"UserBiref='"&UsR.UserBiref&"'"
SQLUpdate=SQLUpdate&" WHERE UserName='"&UsR.UserName&"'"
con.Execute SQLUpdate
End IF
Response.Write("alert("&"""信息修改成功"""&");")
End IF
End IF
%>
}
//两级联动下拉列表函数
function SelCityChange(txt)
{
var tAry;
var tAryNum;
var tNum;
document.City.textCity.value=txt;
tAryNum=0;
tNum=0;
for(var i=0;i<document.townAry.town.length;i++)
{
if(document.townAry.town[i].id==txt)
{
tAryNum=tAryNum+1
}
}
tAry=new Array(tAryNum);
for(var j=0;j<document.townAry.town.length;j++)
{
if(document.townAry.town[j].id==txt)
{
tAry[tNum]=document.townAry.town[j].value;
tNum=tNum+1
}
}
document.Town.selTown.options.length=tAryNum;
for(var k=0;k<tAryNum;k++)
{
document.Town.selTown.options[k].value=tAry[k];
document.Town.selTown.options[k].text=tAry[k];
}
}
//生肖选择函数
function SelZobidac(txt)
{
UserZodiac=txt;
}
//重填按钮函数
function ResetForm()
{
document.fUserRealName.UserRealName.value="";
document.fUserNation.UserNation.value="";
document.City.textCity.value="";
document.Town.textTown.value="";
document.fUserJob.UserJob.value="";
document.fUserEdu.UserEdu.value="";
document.fUserBlood.UserBlood.value="";
document.fUserBelieve.UserBelieve.value="";
document.fUserPhone.UserPhone.value="";
document.fUserMailAddress.UserMailAddress.value="";
document.fUserBiref.UserBiref.value="";
}
//客户端验证提交函数
function VerifyCilck()
{
//得到提交信息
UserRealName=document.fUserRealName.UserRealName.value;
UserNation=document.fUserNation.UserNation.value;
UserProvince=document.City.textCity.value;
UserCity=document.Town.textTown.value;
UserJob=document.fUserJob.UserJob.value;
UserEdu=document.fUserEdu.UserEdu.value;
UserBlood=document.fUserBlood.UserBlood.value;
UserBelieve=document.fUserBelieve.UserBelieve.value;
UserPhone=document.fUserPhone.UserPhone.value;
UserMailAddress=document.fUserMailAddress.UserMailAddress.value;
UserBiref=document.fUserBiref.UserBiref.value;
//有效性验证
if(confirm("确认所有信息以填写正确?"))
{
if(UserRealName=="")
{
alert("真实姓名为空");
return false;
}
if(UserNation=="")
{
alert("国家为空");
return false;
}
if(UserProvince=="")
{
alert("省份为空");
return false;
}
if(UserCity=="")
{
alert("城市为空");
return false;
}
if(UserJob=="")
{
alert("职业为空");
return false;
}
if(UserEdu=="")
{
alert("学历为空");
return false;
}
if(UserBlood=="")
{
alert("血型为空");
return false;
}
if(UserBelieve=="")
{
alert("信仰为空");
return false;
}
if(UserPhone=="")
{
alert("电话为空");
return false;
}
if(UserMailAddress=="")
{
alert("通讯地址为空");
return false;
}
if(UserZodiac=="")
{
alert("请选择属性");
return false;
}
//将信填写息赋给表单并提交到服务器
document.SubFrom.UserRealName.value=UserRealName;
document.SubFrom.UserNation.value=UserNation;
document.SubFrom.UserProvince.value=UserProvince;
document.SubFrom.UserCity.value=UserCity;
document.SubFrom.UserJob.value=UserJob;
document.SubFrom.UserEdu.value=UserEdu;
document.SubFrom.UserZodiac.value=UserZodiac;
document.SubFrom.UserBlood.value=UserBlood;
document.SubFrom.UserBelieve.value=UserBelieve;
document.SubFrom.UserPhone.value=UserPhone;
document.SubFrom.UserMailAddress.value=UserMailAddress;
document.SubFrom.UserBiref.value=UserBiref;
document.SubFrom.IsSubmit.value="T";
document.SubFrom.submit();
}
}
</script>
<META content="MSHTML 6.00.2800.1491" name=GENERATOR></HEAD>
<BODY onLoad="PageInit();">
<TABLE cellSpacing=0 cellPadding=0 width=387 height="377" border=0><!--DWLayoutTable-->
<TBODY>
<TR>
<TD height=20 colspan="2" vAlign=top>
<DIV align=center class=style4>
<div align="left">真实姓名</div>
</DIV></TD>
<TD colspan="5" vAlign=top><form name="fUserRealName" method="post" style="height:20px ">
<input type="text" style="width:120px; height:20px " name="UserRealName" value=<%=UsR.UserRealName%>>
</form></TD>
<TD colspan="3" vAlign=top>
<DIV class=style4
align=center>国家</DIV></TD>
<TD colspan="4" vAlign=top><form name="fUserNation" style="height:20px" method="post">
<input type="text" style="width:155px; height:20px" name="UserNation" value=<%=UsR.UserNation%>>
</form></TD>
</TR>
<TR>
<TD width="33" height=20 vAlign=top>
<DIV align=center><SPAN
class=style4>省份</SPAN></DIV></TD>
<TD colspan="5" vAlign=top>
<form name="City" method="post" style="height:20px ">
<input type="text" style="width:63px; height:20px"name="textCity" value=<%=UsR.UserProvince%>>
<select style="width:65px;height:15px" name="selCity" onChange="SelCityChange(City.selCity.options[selectedIndex].value)">
<option selected>请选择省份</option>
<%
Dim rsProvince
Set rsProvince=Server.CreateObject("ADODB.RecordSet")
rsProvince.Open "Province",con,1,3
Do Until rsProvince.EOF
Response.Write("<option value="&rsProvince.Fields(0).value&">"&rsProvince.Fields(0).value&"</option>"&Chr(13))
rsProvince.MoveNext
Loop
rsProvince.Close
Set rsProvince=Nothing
%>
</select>
</form></TD>
<TD colspan="3" vAlign=top>
<DIV align=center><SPAN
class=style4>城市</SPAN></DIV></TD>
<TD colSpan=5 vAlign=top><form name="Town" method="post" style="height:20px ">
<input type="text" style="width:63px; height:20px"name="textTown" value=<%=UsR.UserCity%>>
<select style="width:77px;height:15px" name="selTown" onChange="Town.textTown.value=Town.selTown.options[selectedIndex].value;">
<option selected>请选择城市</option>
</select>
</form></TD>
</TR>
<TR>
<TD height=20 vAlign=top>
<DIV align=center><SPAN
class=style4>职业</SPAN></DIV></TD>
<TD colspan="2" vAlign=top><form name="fUserJob" method="post" style="height:20px ">
<input style="width:87px; height:20px "type="text" name="UserJob" value="<%=UsR.UserJob%>">
</form></TD>
<TD width="30" vAlign=top>
<DIV align=center><SPAN
class=style4>学历</SPAN></DIV></TD>
<TD colspan="6" vAlign=top><form name="fUserEdu" method="post" style="height:20px ">
<input style="width:75px; height:20px "type="text" name="UserEdu" value=<%=UsR.UserEdu%>>
</form></TD>
<TD colSpan=2 vAlign=top>
<DIV align=center><SPAN
class=style4>血型</SPAN></DIV></TD>
<TD colspan="2" vAlign=top><form name="fUserBlood" method="post">
<input style="width:116px; height:20px; "type="text" name="UserBlood" value=<%=UsR.UserBlood%>>
</form></TD>
</TR>
<TR>
<TD height=20 vAlign=top>
<DIV align=center><SPAN
class=style4>生肖</SPAN></DIV></TD>
<TD colspan="4" vAlign=top><form name="fUserZodiac" method="post">
<select name="UserZodiac" style="width:120px; height:13px" onChange="SelZobidac(fUserZodiac.UserZodiac.options[selectedIndex].value);">
<%
IF UsR.UserZodiac="" Then
Response.Write("<option selected>请&nbsp;选&nbsp;择&nbsp;生&nbsp;肖</option>"&Chr(13))
Else
Response.Write("<option value="&UsR.UserZodiac&"selected>"&UsR.UserZodiac&"</option>"&Chr(13))
End IF
%>
<option value="鼠">子&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;鼠</option>
<option value="牛">丑&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;牛</option>
<option value="虎">寅&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;虎</option>
<option value="兔">牟&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;兔</option>
<option value="龙">晨&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;龙</option>
<option value="蛇">巳&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;蛇</option>
<option value="马">午&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;马</option>
<option value="羊">未&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;羊</option>
<option value="猴">申&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;猴</option>
<option value="鸡">酉&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;鸡</option>
<option value="狗">戌&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;狗</option>
<option value="猪">亥&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;猪</option>
</select>
</form></TD>
<TD colspan="3" vAlign=top>
<DIV align=center><SPAN
class=style4>信仰</SPAN></DIV></TD>
<TD colSpan=6 vAlign=top><form name="fUserBelieve" method="post">
<input style="width:180px; height:20px "type="text" name="UserBelieve" value=<%=UsR.UserBelieve%>>
</form></TD>
</TR>
<TR>
<TD height=20 colspan="2" vAlign=top>
<div align="left"><SPAN
class=style4>联系电话</SPAN></div></TD>
<TD colspan="4" vAlign=top><form name="fUserPhone" method="post">
<input style="width:110px; height:20px "type="text" name="UserPhone" value=<%=UsR.UserPhone%>>
</form></TD>
<TD colspan="5" vAlign=top>
<DIV align=center><SPAN
class=style4>通讯地址</SPAN></DIV></TD>
<TD colSpan=3 vAlign=top><form name="fUserMailAddress" method="post">
<input style="width:142px; height:20px "type="text" name="UserMailAddress" value=<%=UsR.UserMailAdderss%>>
</form></TD>
</TR>
<TR>
<TD height=12 colSpan=14 vAlign=top>
<DIV
align=center class=style5>个&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;简&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;介</DIV></TD>
</TR>
<TR>
<TD height=87 colSpan=14 vAlign=top><form name="fUserBiref" method="post">
<div align="center">
<TEXTAREA style="WIDTH: 387px; HEIGHT: 70px" name="UserBiref" rows=3 cols=42 ALIGN="BOTTOM"></TEXTAREA>
<input name="bValue" type="hidden" value="<%=Server.HTMLEncode(UsR.UserBiref)%>">
</div>
</form></TD>
</TR>
<TR>
<TD height=21 colSpan=14 vAlign=top>
<DIV align=center><INPUT type="button" value=确定 name=Submit onClick="VerifyCilck();">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT type=Button value=重填 name=Submit2 onClick="ResetForm();">
</DIV></TD>
</TR>
<TR>
<TD height="20" colspan="13" vAlign=top>
<form name="SubFrom" method="post" action="UserRealityEdit.asp">
<input type="hidden" name="UserRealName">
<input type="hidden" name="UserNation">
<input type="hidden" name="UserProvince">
<input type="hidden" name="UserCity">
<input type="hidden" name="UserJob">
<input type="hidden" name="UserEdu">
<input type="hidden" name="UserZodiac">
<input type="hidden" name="UserBlood">
<input type="hidden" name="UserBelieve">
<input type="hidden" name="UserPhone">
<input type="hidden" name="UserMailAddress">
<input type="hidden" name="UserBiref">
<input type="hidden" name="IsSubmit">
</form></TD>
<td width="11"></td>
</TR>
<TR>
<TD height="43" colspan="13" vAlign=top>
<form name="townAry" method="post">
<%
Dim rsTown
Set rsTown=Server.CreateObject("ADODB.RecordSet")
rsTown.Open "City",con,1,3
Do Until rsTown.EOF
Response.Write("<input type=hidden name=town id="""&rsTown.Fields(0).value&""" value="&rsTown.Fields(1).Value&">"&Chr(13))
rsTown.MoveNext
Loop
%>
</form></TD>
<td></td>
</TR>
<TR>
<TD height="173">&nbsp;</TD>
<TD width="38">&nbsp;</TD>
<TD width="52">&nbsp;</TD>
<TD>&nbsp;</TD>
<TD width="19">&nbsp;</TD>
<TD width="9">&nbsp;</TD>
<TD width="11">&nbsp;</TD>
<TD width="15">&nbsp;</TD>
<TD width="14">&nbsp;</TD>
<TD width="11">&nbsp;</TD>
<TD width="13">&nbsp;</TD>
<TD width="25">&nbsp;</TD>
<TD width="106">&nbsp;</TD>
<td></td>
</TR>
</TBODY></TABLE>
</BODY>
<%
'网页对象析构区域
rsRe.Close()
Set rsRe=Nothing
Set PageStyleT=Nothing
Set UsR=Nothing
Set oWebI=Nothing
Set ControlR=Nothing
%>
</HTML>[/CODE]

#13
z89656002007-08-20 20:45
回复:(yms123)我很早以前写的二级联动源代码,里面...

谢谢兄弟给我帮助.

有什么不明白再向兄弟请教啊.

#14
uj8yh2007-08-20 21:16
<!--#include file="../session.asp"-->
试试
#15
wfw182008-03-20 22:29
我在预览时,二级菜单中没内容,急等版主大师帮忙!
若有高人指点,小弟不胜感激!全是从网上下载的代码,按说明做的,可在预览时,二级菜单中不显示一级菜单对应的内容
<select name="Class1" onChange="javascript:change_select(this.options[this.selectedIndex].value)">
<option value="0">选择分类</option>
<%
Set rs =Server.CreateObject("ADODB.RecordSet")
sql="select * from DH_Class1"
rs.open sql,conn,1,1
For i = 1 To rs.RecordCount%>
<option value="<%=rs("ID_Class1")%>"><%=rs("Name_Class1")%></option>
<%
rs.MoveNext
Next
rs.Close
sql="select * from DH_Class2"
rs.open sql,conn,1,1
%>
</select>
<select name="Class2">
<option value="0">选择小类别</option>
</select>
<script language = "javascript">
arrSelect=new Array();
arrSelect[0] = new Array("选择分类",0,0)
<%
For i = 1 To rs.RecordCount
%>
arrSelect[<%= i %>]=new Array("<%= rs("Name_Class2") %>","<%= rs("Class1ID") %>","<%= rs("ID_Class2") %>");
<%
rs.MoveNext
Next
rs.Close
Set rs=nothing
%>
function change_select(selvalue)
{
document.all.Class2.length=0;
var i;
for(i=0;i<arrSelect.length;i++)
{
if(arrSelect[1]==selvalue)
{
var newOption=new Option(arrSelect[0],arrSelect[2]);
document.all.Class2.add(newOption);
}
}
}
</script>
1