| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 674 人关注过本帖
标题:有耐心的进来....帮个忙简化一下...大家来看看
只看楼主 加入收藏
ih_ks
Rank: 1
等 级:新手上路
帖 子:182
专家分:0
注 册:2007-1-1
收藏
 问题点数:0 回复次数:6 
有耐心的进来....帮个忙简化一下...大家来看看

第四次发这个下级菜单的请求了...好像每次都没人看懂我的是什么问题...整整一个星期还没找出解决方法.....花了2个小时把这个弄了出来....因为不懂如何循环所有把所有的都列出来的...请耐心人士帮我简化一下..这里面太多一样的了.....附上全部文件....

-------------------------------------------------下面是代码---------------------------------------------
<!--#include file="conn.asp"-->
<%
Set rs1=server.CreateObject("adodb.recordset")
Sql1="Select * From Connect1 Order By ConID"
rs1.open Sql1,conn,1,1
rscount=rs1.recordcount
n=1
%>
<%
Set rs2=server.CreateObject("adodb.recordset")
Sql2="Select * From Connect1 Where ConID=1"
rs2.open Sql2,conn,1,1
%>
<%
Set rs3=server.CreateObject("adodb.recordset")
Sql3="Select * From Connect1 Where ConID=2"
rs3.open Sql3,conn,1,1
%>
<%
Set rs4=server.CreateObject("adodb.recordset")
Sql4="Select * From Connect1 Where ConID=3"
rs4.open Sql4,conn,1,1
%>
<%
Set rs5=server.CreateObject("adodb.recordset")
Sql5="Select * From Connect1 Where ConID=4"
rs5.open Sql5,conn,1,1
%>
<%
Set rs6=server.CreateObject("adodb.recordset")
Sql6="Select * From Connect1 Where ConID=5"
rs6.open Sql6,conn,1,1
%>
<%
Set rs7=server.CreateObject("adodb.recordset")
Sql7="Select * From Connect1 Where ConID=6"
rs7.open Sql7,conn,1,1
%>
<%
Set rs8=server.CreateObject("adodb.recordset")
Sql8="Select * From Connect1 Where ConID=7"
rs8.open Sql8,conn,1,1
%>
<%
Set rs9=server.CreateObject("adodb.recordset")
Sql9="Select * From Connect1 Where ConID=8"
rs9.open Sql9,conn,1,1
%>
<%
Set Trs1=server.CreateObject("adodb.recordset")
TSql1="Select * From T_Connect Where ConID=1"
Trs1.open TSql1,conn,1,1
%>
<%
Set Trs2=server.CreateObject("adodb.recordset")
TSql2="Select * From T_Connect Where ConID=2"
Trs2.open TSql2,conn,1,1
%>
<%
Set Trs3=server.CreateObject("adodb.recordset")
TSql3="Select * From T_Connect Where ConID=3"
Trs3.open TSql3,conn,1,1
%>
<%
Set Trs4=server.CreateObject("adodb.recordset")
TSql4="Select * From T_Connect Where ConID=4"
Trs4.open TSql4,conn,1,1
%>
<%
Set Trs5=server.CreateObject("adodb.recordset")
TSql5="Select * From T_Connect Where ConID=5"
Trs5.open TSql5,conn,1,1
%>
<%
Set Trs6=server.CreateObject("adodb.recordset")
TSql6="Select * From T_Connect Where ConID=6"
Trs6.open TSql6,conn,1,1
%>
<%
Set Trs7=server.CreateObject("adodb.recordset")
TSql7="Select * From T_Connect Where ConID=7"
Trs7.open TSql7,conn,1,1
%>
<%
Set Trs8=server.CreateObject("adodb.recordset")
TSql8="Select * From T_Connect Where ConID=8"
Trs8.open TSql8,conn,1,1
%>
<html>
<head>
<title></title>
<SCRIPT language=javascript><!--
<% do while not rs1.eof%>
function out<%=rs1("ConID")%>()
{
if(window.event.toElement.id!="menu<%=rs1("ConID")%>" && window.event.toElement.id!="link")
menu<%=rs1("ConID")%>.style.visibility="hidden";
}
<%
rs1.movenext
Loop
%>
//-->

</SCRIPT>
</head>
<body>
<div id="back" onMouseOut="out1()" onMouseOver="menu1.style.visibility='visible'" style="position:absolute;top:15;left:<%=800/rscount%>;width:<%=800/rscount%>;height:40;z-index:1;visibility:visible;">
<table>
<tr>
<td width="<%=800/rscount%>"><%=rs2("ConName")%></td>
</tr>
</table>
<div border=1 id="menu1" style="position:absolute;top:15;left:0;width:<%=800/rscount%>;height:10;z-index:2;visibility:hidden;">
<table>
<tr>
<% do while not Trs1.eof%>
<td width="<%=800/rscount%>"><%=Trs1("T_ConName")%></td>
</tr>
<%
Trs1.movenext
Loop
%>
</table>
</div>
</div>
<div id="back" onMouseOut="out2()" onMouseOver="menu2.style.visibility='visible'" style="position:absolute;top:15;left:<%=2*800/rscount%>;width:<%=800/rscount%>;height:40;z-index:3;visibility:visible;">
<table>
<tr>
<td width="<%=800/rscount%>"><%=rs3("ConName")%></td>
</tr>
</table>
<div border=1 id="menu2" style="position:absolute;top:15;left:0;width:<%=800/rscount%>;height:10;z-index:4;visibility:hidden;">
<table>
<tr>
<% do while not Trs2.eof%>
<td width="<%=800/rscount%>"><%=Trs2("T_ConName")%></td>
</tr>
<%
Trs2.movenext
Loop
%>
</table>
</div>
</div>
<div id="back" onMouseOut="out3()" onMouseOver="menu3.style.visibility='visible'" style="position:absolute;top:15;left:<%=3*800/rscount%>;width:<%=800/rscount%>;height:40;z-index:5;visibility:visible;">
<table>
<tr>
<td width="<%=800/rscount%>"><%=rs4("ConName")%></td>
</tr>
</table>
<div border=1 id="menu3" style="position:absolute;top:15;left:0;width:<%=800/rscount%>;height:10;z-index:6;visibility:hidden;">
<table>
<tr>
<% do while not Trs3.eof%>
<td width="<%=800/rscount%>"><%=Trs3("T_ConName")%></td>
</tr>
<%
Trs3.movenext
Loop
%>
</table>
</div>
</div>
<div id="back" onMouseOut="out4()" onMouseOver="menu4.style.visibility='visible'" style="position:absolute;top:15;left:<%=4*800/rscount%>;width:<%=800/rscount%>;height:40;z-index:7;visibility:visible;">
<table>
<tr>
<td width="<%=800/rscount%>"><%=rs5("ConName")%></td>
</tr>
</table>
<div border=1 id="menu4" style="position:absolute;top:15;left:0;width:<%=800/rscount%>;height:10;z-index:8;visibility:hidden;">
<table>
<tr>
<% do while not Trs4.eof%>
<td width="<%=800/rscount%>"><%=Trs4("T_ConName")%></td>
</tr>
<%
Trs4.movenext
Loop
%>
</table>
</div>
</div>
<div id="back" onMouseOut="out5()" onMouseOver="menu5.style.visibility='visible'" style="position:absolute;top:15;left:<%=5*800/rscount%>;width:<%=800/rscount%>;height:40;z-index:9;visibility:visible;">
<table>
<tr>
<td width="<%=800/rscount%>"><%=rs6("ConName")%></td>
</tr>
</table>
<div border=1 id="menu5" style="position:absolute;top:15;left:0;width:<%=800/rscount%>;height:10;z-index:10;visibility:hidden;">
<table>
<tr>
<% do while not Trs5.eof%>
<td width="<%=800/rscount%>"><%=Trs5("T_ConName")%></td>
</tr>
<%
Trs5.movenext
Loop
%>
</table>
</div>
</div>
<div id="back" onMouseOut="out6()" onMouseOver="menu6.style.visibility='visible'" style="position:absolute;top:15;left:<%=6*800/rscount%>;width:<%=800/rscount%>;height:40;z-index:11;visibility:visible;">
<table>
<tr>
<td width="<%=800/rscount%>"><%=rs7("ConName")%></td>
</tr>
</table>
<div border=1 id="menu6" style="position:absolute;top:15;left:0;width:<%=800/rscount%>;height:10;z-index:12;visibility:hidden;">
<table>
<tr>
<% do while not Trs6.eof%>
<td width="<%=800/rscount%>"><%=Trs6("T_ConName")%></td>
</tr>
<%
Trs6.movenext
Loop
%>
</table>
</div>
</div>
<div id="back" onMouseOut="out7()" onMouseOver="menu7.style.visibility='visible'" style="position:absolute;top:15;left:<%=7*800/rscount%>;width:<%=800/rscount%>;height:40;z-index:13;visibility:visible;">
<table>
<tr>
<td width="<%=800/rscount%>"><%=rs8("ConName")%></td>
</tr>
</table>
<div border=1 id="menu7" style="position:absolute;top:15;left:0;width:<%=800/rscount%>;height:10;z-index:14;visibility:hidden;">
<table>
<tr>
<% do while not Trs7.eof%>
<td width="<%=800/rscount%>"><%=Trs7("T_ConName")%></td>
</tr>
<%
Trs7.movenext
Loop
%>
</table>
</div>
</div>
<div id="back" onMouseOut="out8()" onMouseOver="menu8.style.visibility='visible'" style="position:absolute;top:15;left:<%=8*800/rscount%>;width:<%=800/rscount%>;height:40;z-index:15;visibility:visible;">
<table>
<tr>
<td width="<%=800/rscount%>"><%=rs9("ConName")%></td>
</tr>
</table>
<div border=1 id="menu8" style="position:absolute;top:15;left:0;width:<%=800/rscount%>;height:10;z-index:16;visibility:hidden;">
<table>
<tr>
<% do while not Trs8.eof%>
<td width="<%=800/rscount%>"><%=Trs8("T_ConName")%></td>
</tr>
<%
Trs8.movenext
Loop
%>
</table>
</div>
</div>
</body>
</html>

q36Nnu8e.rar (18.57 KB) 有耐心的进来....帮个忙简化一下...大家来看看


搜索更多相关主题的帖子: 耐心 
2007-06-15 04:19
windtear
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2007-6-13
收藏
得分:0 
ConID=?可以用两个Function实现你上面的两个表中数据传递,如ConID="&amp;Request(".....")这样节省了很多代码了

[此贴子已经被作者于2007-6-15 8:36:23编辑过]



Web my life...
2007-06-15 08:31
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
[QUOTE]<!--#include file="conn.asp"-->
<html>
<head>
<title></title>
<SCRIPT language=javascript><!--
function out(id){
if(window.event.toElement.id!="menu"+ id && window.event.toElement.id!="link")
document.getElementById("menu"+id).style.visibility="hidden";
}
//-->
</SCRIPT>
</head>
<body>
<%
Dim IntI,rscount,rs,Trs
IntI = 0
Set rs=server.CreateObject("adodb.recordset")
Set Trs=server.CreateObject("adodb.recordset")
Sql="Select * From Connect1 Order By ConID"
rs.open Sql,conn,1,1
rscount = rs.Recordcount
Do While Not Rs.Eof
IntI = IntI + 1
TSql="Select * From T_Connect Where ConID="& rs("ConId")
Trs.open TSql,conn,1,1
%>
<div id="back" onMouseOut="out(<%=IntI%>)" onMouseOver="menu<%=IntI%>.style.visibility='visible'" style="position:relative;top:15; float:left;width:<%=800/rscount%>;height:40;z-index:1;visibility:visible;">
<table>
<tr><td width="<%=800/rscount%>"><%=rs("ConName")%></td></tr>
</table>
<div id="menu<%=IntI%>" style="border:1px solid #CCCCCC;width:<%=800/rscount%>;z-index:2;visibility:hidden;">
<table>
<%
do while not Trs.eof
%>
<tr><td><%=Trs("T_ConName")%></td></tr>
<%
Trs.movenext
Loop
Trs.Close()
%>
</table>
</div>
</div>
<%
rs.movenext
Loop
rs.close()
set Trs= Nothing
set rs = Nothing
%>
</body>
</html>[/QUOTE]

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-06-15 09:01
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

稍微给你改了下,这样的动态菜单提取,主要的循环,LZ这只有两级,如果是多级的话,就应该用递归了!


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-06-15 09:03
ih_ks
Rank: 1
等 级:新手上路
帖 子:182
专家分:0
注 册:2007-1-1
收藏
得分:0 
4楼的...太感谢你了....
2007-06-15 11:21
SkyGull
Rank: 5Rank: 5
来 自:浙江杭州
等 级:贵宾
威 望:13
帖 子:839
专家分:324
注 册:2007-6-7
收藏
得分:0 
天呐,都到Trs了...
你强悍啊
2007-06-15 14:29
恒天
Rank: 1
等 级:新手上路
威 望:2
帖 子:165
专家分:0
注 册:2007-6-1
收藏
得分:0 
已经解决了就没我的事了
2007-06-15 17:17
快速回复:有耐心的进来....帮个忙简化一下...大家来看看
数据加载中...
 
   



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

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