关于层的隐藏和显示,不会做啊,求助?

hateyoucode 2005-10-11 04:41:08
刚开始是2个层都不显示,当点击文字“显示层1”是层1显示,刷新页面层1还是存在,然后点击文字“显示层2”,层1隐藏,层2显示,刷新页面就只显示层2,不显示层1
这个功能完成不了啊?
那位帮帮忙?
...全文
430 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
xxuu503 2006-02-13
  • 打赏
  • 举报
回复
刷新肯定恢复
网络老男孩了 2006-02-13
  • 打赏
  • 举报
回复
<table style="cursor : hand" onClick="return chg_chnl('supplier')" border=0 cellpadding=0 cellspacing=0 width="100%">
<tr>
<td align="center"><strong><font color="#FFFFFF" size="3"><span>供应商管理</span></font></strong></td>
<td align="center"><div id="div_supplier" class="jd">6</div></td>
</tr>
<tr>
<TD height=1 bgcolor="#EFEFEF" colspan=2><img src="" height=1 width=100 border=0></td>
</tr>
</table>
<div id="supplier" style="display : none">
<table width="100%" border="0" cellpadding=1 cellspacing=1>
<% If inStr("Director,Supervisor,MarketRecorder,Programmer",session("adminClass"))>0 Then %>
<tr>
<td class="menu_title" align="center" onmouseover="this.className='menu_title2'" onmouseout="this.className='menu_title'" style="cursor:hand" background="image/menudown.gif" height="22"><a href="ViewSupplier.asp" target="main"><span>供应商管理</span></a></td>
</tr>
<%end if%>
<% If inStr("Director,Supervisor,SaleManagement,Programmer",session("adminClass"))>0 Then %>
<tr>
<td class="menu_title" align="center" onmouseover="this.className='menu_title2'" onmouseout="this.className='menu_title'" style="cursor:hand" background="image/menudown.gif" height="22"><a href="../supplier/supplier_products.asp" target="main"><span>供应商产品</span></a></td>
</tr>
<%end if%>
<% If inStr("Director,Supervisor,Programmer",session("adminClass"))>0 or inStr(UCase(elect),UCase(session("username")))>0 Then %>
<tr>
<td class="menu_title" align="center" onmouseover="this.className='menu_title2'" onmouseout="this.className='menu_title'" style="cursor:hand" background="image/menudown.gif" height="22"><a href="../supplier/supplier_electproductsshow.asp" target="main"><span>供应商电子产品</span></a></td>
</tr>
<%end if%>
</table>
</div>

<table style="cursor : hand" onClick="return chg_chnl('xinxi')" border=0 cellpadding=0 cellspacing=0 width="100%">
<tr>
<td align="center"><strong><font color="#FFFFFF" size="3"><span>登陆信息</span></font></strong></td>
<td align="center"><div id="div_xinxi" class="jd">6</div></td>
</tr>
<tr>
<TD height=1 bgcolor="#EFEFEF" colspan=2><img src="" height=1 width=100 border=0></td>
</tr>
</table>
<div id="xinxi" style="display : none">
<table cellspacing="0" cellpadding="0" width="135" align="center">
<tr>
<td height="20"><br/>
网 址:<%= Request.ServerVariables("SERVER_NAME")
%><br/>
日 期:<%= FormatDateTime(now(),1) %><br/>
时 间:<%= FormatDateTime(now(),4) %><br/>
管理员:<%= session("username") %><br/>
级 别:<%= session("adminClass") %><br/>
真实IP:<%= Request.ServerVariables("REMOTE_ADDR")
%> <br/>
<br/>
</td>
</tr>
<% If inStr("Director,Programmer",session("adminClass"))>0 Then %>
<tr>
<td valign=top><a href="count1\main.asp" target="main">※ 总体数据</a> <br/>
<a href="count1\tj_all.asp" target="main">※ 详细记录</a> <br/>
<a href="count1\tj_hour.asp" target="main">※ 24小时统计</a> <br/>
<a href="count1\tj_day.asp" target="main">※ 日统计</a> <br/>
<a href="count1\tj_week.asp" target="main">※ 周统计</a> <br/>
<a href="count1\tj_month.asp" target="main">※ 月统计</a> <br/>
<a href="count1\tj_come.asp" target="main">※ 来路统计</a> <br/>
<a href="count1\tj_page.asp" target="main">※ 被访页面</a> <br/>
<a href="count1\tj_ip.asp" target="main">※ IP统计</a> <br/>
<a href="count1\tj_soft.asp" target="main">※ 客户端软件</a> <br/>
<a href="count1\tj_where.asp" target="main">※ 访问者地区</a> </td>
</tr>
<tr height=60 >
<td valign=top><a href="count1\tj_search.asp" target="main">自定义统计</a>
<%set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("count1\count.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set rs = Server.CreateObject("ADODB.Recordset")

sql="select top 2 * from save"
rs.Open sql,conn,1,1
do while not rs.EOF
%>
<br/>
<a href="count1\tj_searchgo.asp?wherestr=<%=server.URLEncode(rs("wherestr"))%>&outtype=<%=server.URLEncode(rs("outtype"))%>&name=<%=server.URLEncode(rs("name"))%>&content=<%=server.URLEncode(rs("content"))%>" target="main">※ <%=left(rs("name"),6)%></a> <br/>
        <a href="count1\tj_search.asp" target="main">更多...</a>
<%
rs.MoveNext
loop
rs.Close
set rs=nothing
conn.Close
set conn=nothing
%>
</td>
</tr>
<% End If %>
</table>
</div></td>
</tr>
</table>

<script language="JavaScript" type="text/javascript">
function chg_chnl(chnl){
if(document.all){
supplier.style.display = 'none'; div_supplier.innerHTML = '6';
xinxi.style.display = 'none'; div_xinxi.innerHTML = '6';
switch(chnl){

case 'supplier':
supplier.style.display = ''; div_supplier.innerHTML = '5'; break;
case 'xinxi':
xinxi.style.display = ''; div_xinxi.innerHTML = '5'; break;
case 'exit':
top.location.href = 'logout.asp'; break;
default:
//默认显示
xinxi.style.display = ''; break;
}
}
return false;
}
</script>
行近远山 2006-02-13
  • 打赏
  • 举报
回复
楼上是用js控制的,能不能asp代码直接控制啊?
比如:if session("aaa")<>null then 让这个隐藏同时让另一个层显示~!
sulone 2005-10-11
  • 打赏
  • 举报
回复
这个应该没问题吧
<body onload=loadLayer()>
<script language=javascript>
function loadLayer(){
if(document.cookie=='layer1'){
window.layer1.style.visibility='visible';
window.layer2.style.visibility='hidden';
}else{
window.layer1.style.visibility='hidden';
window.layer2.style.visibility='visible';
}

}
</script>
<a style="cursor:hand;" onclick="window.layer1.style.visibility='visible';window.layer2.style.visibility='hidden';document.cookie='layer1'">显示层1</a>
<a style="cursor:hand;" onclick="window.layer2.style.visibility='visible';window.layer1.style.visibility='hidden';document.cookie='layer2'">显示层2</a>
<div style="position: absolute; width: 100px; height: 100px; z-index: 1; left:9px; top:40px;visibility:hidden; background-color:#C0C0C0" id="layer1">层1</div>
<div style="position: absolute; width: 100px; height: 100px; z-index: 1; left: 126px; top: 40px;visibility:hidden; background-color:#008000" id="layer2">层2</div>
</body>
black325 2005-10-11
  • 打赏
  • 举报
回复
UP
lamking 2005-10-11
  • 打赏
  • 举报
回复
肯定要有记录状态的东西.比如放在cookie里边
legend1970 2005-10-11
  • 打赏
  • 举报
回复
没有必要自己写代码,在DreamVeaver MX中利用向导就完成了!非常简单!
diyager 2005-10-11
  • 打赏
  • 举报
回复
指在asp中。其它的我也不清楚
diyager 2005-10-11
  • 打赏
  • 举报
回复
当点击过以后记录一下临时记录,比如用session
很容易的
大猫钓鱼 2005-10-11
  • 打赏
  • 举报
回复
个人感觉你至少得有个标识用来记录当前层的状态吧。
lnboy1003 2005-10-11
  • 打赏
  • 举报
回复
感觉不太可能刷新不恢复原样,学习
lnboy1003 2005-10-11
  • 打赏
  • 举报
回复
感觉不太可能刷新不恢复原样,学习
xxrl 2005-10-11
  • 打赏
  • 举报
回复
刷新肯定会初始化阿
xxrl 2005-10-11
  • 打赏
  • 举报
回复
通过设置layer的display属性来实现你这个功能
hateyoucode 2005-10-11
  • 打赏
  • 举报
回复
但是显示了层1后 刷新一下 层1 又隐藏了 怎么办啊?
tigerwen01 2005-10-11
  • 打赏
  • 举报
回复
<layer></layer>这是层标志,它有很多属性,其中zindex=0,1,...表示层次;hide表示隐藏等等。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧