cookies控制的树形导航,如何修改,能点击一个一级菜单后,其他一级菜单的二级菜单全部收起隐藏? 80
高分悬赏,请高手联系我获取代码,或者在地址http://bbs.blueidea.com/thread-2728441-1-1.html获取...
高分悬赏,请高手联系我获取代码,或者在地址http://bbs.blueidea.com/thread-2728441-1-1.html 获取
展开
1个回答
展开全部
应该是你要的效果:
<!--Modify by visc.cn for cbiw.com.cn 2007-03-19-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>刷新不变化树形菜单 - 未寺客JS</title>
<style type="text/css">
body,td,th {font-size: 14px;}
.leftmenu1 {font-weight: bold; cursor: hand; padding-top: 4px; height: 29px; text-align: left;}
.leftmenu2 {PADDING-LEFT:15px; height: 21px;text-align: left;}
div{ margin-top:90px; width:100%; text-align:center; }
</style>
</head>
<body>
<div>
<script language="JavaScript" type="text/javascript">
var on_img="http://www.cbiw.com.cn/member/pic/ass04.gif";//打开时图片
var off_img="http://www.cbiw.com.cn/member/pic/ass03.gif";//隐藏时图片
var totalShow = 5; //自己修改一共有多少个二级分类
function Show(id,i_id){
// 参数
var obj=document.getElementById('c_'+id);
var curShow = readCookie('curShow');
var arr_curShow = curShow.split(',');
if (obj.style.display == 'none')
{
// 动作
obj.style.display="";
i_id.src=on_img;
// Cookies
writeCookie('curShow',id,12)
// 关闭其它
for(var i=1; i<=totalShow; i++)
{
if (i == id) continue;
document.getElementById('c_'+i).style.display="none";
document.getElementById('img'+i).src=off_img;
}
}
else
{
obj.style.display="none";
i_id.src=off_img;
writeCookie('curShow','',12)
}
}
function readCookie(name)
{
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0)
{
offset = document.cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}
function writeCookie(name, value, hours)
{
var expire = "";
if(hours != null)
{
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = "; expires=" + expire.toGMTString();
}
document.cookie = name + "=" + escape(value) + expire;
}
Array.prototype.del=function(n) { //n表示第几项,从0开始算起。
//prototype为对象原型,注意这里为对象增加自定义方法的方法。
if(n<0) //如果n<0,则不进行任何操作。
return this;
else
return this.slice(0,n).concat(this.slice(n+1,this.length));
}
window.onload = function a()
{
var curShow = readCookie('curShow');
if(curShow!=''&&curShow!=null)
{
for(i=1;i<=totalShow;i++)
{
document.getElementById('c_'+i).display="none";
}
var arr_curShow;
arr_curShow = curShow.split(',');
for(i=0;i<=arr_curShow.length-1;i++)
{
if(arr_curShow[i]!=''){
document.getElementById('c_'+arr_curShow[i]).style.display="";
document.getElementById('img'+arr_curShow[i]).src=on_img;
}
}
}
}
</script>
<table width="10%" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(1,img1)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img1"/><span class="ft_white"> 个人资料</span></a></td></tr>
</tbody>
<tbody id="c_1" style="display: none">
<tr>
<td class="leftmenu2"><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">基本信息</a></td></tr>
<tr>
<td class="leftmenu2"><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">修改密码</a></td></tr>
</tbody>
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(2,img2)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img2"/><span class="ft_white"> 我的简历</span></a></td></tr>
</tbody>
<tbody id="c_2" style="display: none">
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">求职简历</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">求职意向</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">上传照片</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">简历预览</a></td></tr>
</tbody>
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(3,img3)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img3"/><span class="ft_white"> 职位搜索</span></a></td></tr>
</tbody>
<tbody id="c_3" style="display: none">
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">快速搜索</a></td></tr>
</tbody>
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(4,img4)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img4"/><span class="ft_white"> 应聘管理</span></a></td></tr>
</tbody>
<tbody id="c_4" style="display: none">
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">应聘记录</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">企业邀请</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">收藏职位</a></td></tr>
</tbody>
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(5,img5)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img5"/><span class="ft_white"> 我的知识</span></a></td></tr>
</tbody>
<tbody id="c_5" style="display: none">
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">我要提问</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">我要回答</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">发问记录</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">回答记录</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="http://www.visc.cn" target="_blank" title="未寺客(visc.cn) - 做个广告,嘿嘿">分数记录</a></td></tr>
</tbody>
</table>
</div>
</body>
</html>
<!--Modify by visc.cn for cbiw.com.cn 2007-03-19-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>刷新不变化树形菜单 - 未寺客JS</title>
<style type="text/css">
body,td,th {font-size: 14px;}
.leftmenu1 {font-weight: bold; cursor: hand; padding-top: 4px; height: 29px; text-align: left;}
.leftmenu2 {PADDING-LEFT:15px; height: 21px;text-align: left;}
div{ margin-top:90px; width:100%; text-align:center; }
</style>
</head>
<body>
<div>
<script language="JavaScript" type="text/javascript">
var on_img="http://www.cbiw.com.cn/member/pic/ass04.gif";//打开时图片
var off_img="http://www.cbiw.com.cn/member/pic/ass03.gif";//隐藏时图片
var totalShow = 5; //自己修改一共有多少个二级分类
function Show(id,i_id){
// 参数
var obj=document.getElementById('c_'+id);
var curShow = readCookie('curShow');
var arr_curShow = curShow.split(',');
if (obj.style.display == 'none')
{
// 动作
obj.style.display="";
i_id.src=on_img;
// Cookies
writeCookie('curShow',id,12)
// 关闭其它
for(var i=1; i<=totalShow; i++)
{
if (i == id) continue;
document.getElementById('c_'+i).style.display="none";
document.getElementById('img'+i).src=off_img;
}
}
else
{
obj.style.display="none";
i_id.src=off_img;
writeCookie('curShow','',12)
}
}
function readCookie(name)
{
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0)
{
offset = document.cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}
function writeCookie(name, value, hours)
{
var expire = "";
if(hours != null)
{
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = "; expires=" + expire.toGMTString();
}
document.cookie = name + "=" + escape(value) + expire;
}
Array.prototype.del=function(n) { //n表示第几项,从0开始算起。
//prototype为对象原型,注意这里为对象增加自定义方法的方法。
if(n<0) //如果n<0,则不进行任何操作。
return this;
else
return this.slice(0,n).concat(this.slice(n+1,this.length));
}
window.onload = function a()
{
var curShow = readCookie('curShow');
if(curShow!=''&&curShow!=null)
{
for(i=1;i<=totalShow;i++)
{
document.getElementById('c_'+i).display="none";
}
var arr_curShow;
arr_curShow = curShow.split(',');
for(i=0;i<=arr_curShow.length-1;i++)
{
if(arr_curShow[i]!=''){
document.getElementById('c_'+arr_curShow[i]).style.display="";
document.getElementById('img'+arr_curShow[i]).src=on_img;
}
}
}
}
</script>
<table width="10%" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(1,img1)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img1"/><span class="ft_white"> 个人资料</span></a></td></tr>
</tbody>
<tbody id="c_1" style="display: none">
<tr>
<td class="leftmenu2"><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">基本信息</a></td></tr>
<tr>
<td class="leftmenu2"><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">修改密码</a></td></tr>
</tbody>
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(2,img2)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img2"/><span class="ft_white"> 我的简历</span></a></td></tr>
</tbody>
<tbody id="c_2" style="display: none">
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">求职简历</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">求职意向</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">上传照片</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">简历预览</a></td></tr>
</tbody>
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(3,img3)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img3"/><span class="ft_white"> 职位搜索</span></a></td></tr>
</tbody>
<tbody id="c_3" style="display: none">
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">快速搜索</a></td></tr>
</tbody>
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(4,img4)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img4"/><span class="ft_white"> 应聘管理</span></a></td></tr>
</tbody>
<tbody id="c_4" style="display: none">
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">应聘记录</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">企业邀请</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">收藏职位</a></td></tr>
</tbody>
<tbody>
<tr>
<td class="leftmenu1"> <a style="cursor: pointer" onclick="Show(5,img5)"><img src="http://www.cbiw.com.cn/member/pic/ass03.gif" width="16" height="16" align="absmiddle" id="img5"/><span class="ft_white"> 我的知识</span></a></td></tr>
</tbody>
<tbody id="c_5" style="display: none">
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">我要提问</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">我要回答</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">发问记录</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="#">回答记录</a></td></tr>
<tr>
<td class="leftmenu2" ><img src="http://www.cbiw.com.cn/member/pic/ass06.gif" width="9" height="9" /> <a href="http://www.visc.cn" target="_blank" title="未寺客(visc.cn) - 做个广告,嘿嘿">分数记录</a></td></tr>
</tbody>
</table>
</div>
</body>
</html>
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询