蝙蝠岛资源网 Design By www.hbtsch.com
复制代码 代码如下:
<!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<hrad>
<metahttp-equiv="content-type"content="text/html;charset=utf-8">
<title>可折叠的两级菜单</title>
<styletype="text/css">
<!--
body{
background-color:#ffdee0;
}
#navigation {
width:200px;
font-family:Arial;
}
#navigation > ul {
list-style-type:none;
margin:0px;
padding:0px;
}
#navigation > ul >li {
border-bottom:1pxsolid #ED9F9F;
}
#navigation > ul >li > a{
display:block;
padding:5px5px 5px 0.5em;
text-decoration:none;
border-left:12pxsolid #711515;
border-right:1pxsolid #711515;
}
#navigation > ul >li > a:link, #navigation >ul >li > a:visited{
background-color:#c11136;
color:#FFFFFF;
}
#navigation > ul >li > a:hover{
background-color:#990020;
color:#ffff00;
}
.txt{
background-color:#c11136;
color:#FFFFFF;
padding:5px5px 5px 0.5em;
text-decoration:none;
border-left:12pxsolid #711515;
border-right:1pxsolid #711515;
}
/* 子菜单的CSS样式 */
#navigation ul li ul{
list-style-type:none;
margin:0px;
padding:0px0px 0px 0px;
}
#navigation ul li ulli{
border-top:1pxsolid #ED9F9F;
}
#navigation ul li ulli a{
display:block;
padding:3px3px 3px 0.5em;
text-decoration:none;
border-left:28pxsolid #a71f1f;
border-right:1pxsolid #711515;
}
#navigation ul li ulli a:link, #navigationul li ul lia:visited{
background-color:#e85070;
color:#FFFFFF;
}
#navigation ul li ulli a:hover{
background-color:#c2425d;
color:#ffff00;
}
#navigation ul li ul.myHide{ /* 隐藏子菜单 */
display:none;
}
#navigation ul li ul.myShow{ /* 显示子菜单 */
display:block;
}
-->
</style>
<scriptlanguage="javascript">
window.onload=function(){
varlistUL=document.getElementById("listUL");
varolist=listUL.childNodes;
varoa=0;
for(var i = 0; i < olist.length; i++) {
if(olist[i].tagName=="LI"&&olist[i].getElementsByTagName("ul")[0]){
oa=olist[i];
oa.onclick=change;
}
}
functionchange(){
varos=this.getElementsByTagName("ul")[0];
if(os.className=="myHide")
os.className="myShow";
else
os.className="myHide";
}
}
</script>
</hrad>
<body>
<divid="navigation">
<ulid="listUL">
<li>
<divclass="txt">Home</div>
</li>
<li>
<divclass="txt">news</div>
<ulclass="myHide">
<li><ahref="#">lastest news</a></li>
<li><ahref="#">all news</a></li>
</ul>
</li>
<li>
<divclass="txt">sports</div>
<ulclass="myHide">
<li><ahref="#">lastest news</a></li>
<li><ahref="#">all news</a></li>
</ul>
</li>
<li>
<divclass="txt">weather</div>
<ulclass="myHide">
<li><ahref="#">lastest news</a></li>
<li><ahref="#">all news</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>
<!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<hrad>
<metahttp-equiv="content-type"content="text/html;charset=utf-8">
<title>可折叠的两级菜单</title>
<styletype="text/css">
<!--
body{
background-color:#ffdee0;
}
#navigation {
width:200px;
font-family:Arial;
}
#navigation > ul {
list-style-type:none;
margin:0px;
padding:0px;
}
#navigation > ul >li {
border-bottom:1pxsolid #ED9F9F;
}
#navigation > ul >li > a{
display:block;
padding:5px5px 5px 0.5em;
text-decoration:none;
border-left:12pxsolid #711515;
border-right:1pxsolid #711515;
}
#navigation > ul >li > a:link, #navigation >ul >li > a:visited{
background-color:#c11136;
color:#FFFFFF;
}
#navigation > ul >li > a:hover{
background-color:#990020;
color:#ffff00;
}
.txt{
background-color:#c11136;
color:#FFFFFF;
padding:5px5px 5px 0.5em;
text-decoration:none;
border-left:12pxsolid #711515;
border-right:1pxsolid #711515;
}
/* 子菜单的CSS样式 */
#navigation ul li ul{
list-style-type:none;
margin:0px;
padding:0px0px 0px 0px;
}
#navigation ul li ulli{
border-top:1pxsolid #ED9F9F;
}
#navigation ul li ulli a{
display:block;
padding:3px3px 3px 0.5em;
text-decoration:none;
border-left:28pxsolid #a71f1f;
border-right:1pxsolid #711515;
}
#navigation ul li ulli a:link, #navigationul li ul lia:visited{
background-color:#e85070;
color:#FFFFFF;
}
#navigation ul li ulli a:hover{
background-color:#c2425d;
color:#ffff00;
}
#navigation ul li ul.myHide{ /* 隐藏子菜单 */
display:none;
}
#navigation ul li ul.myShow{ /* 显示子菜单 */
display:block;
}
-->
</style>
<scriptlanguage="javascript">
window.onload=function(){
varlistUL=document.getElementById("listUL");
varolist=listUL.childNodes;
varoa=0;
for(var i = 0; i < olist.length; i++) {
if(olist[i].tagName=="LI"&&olist[i].getElementsByTagName("ul")[0]){
oa=olist[i];
oa.onclick=change;
}
}
functionchange(){
varos=this.getElementsByTagName("ul")[0];
if(os.className=="myHide")
os.className="myShow";
else
os.className="myHide";
}
}
</script>
</hrad>
<body>
<divid="navigation">
<ulid="listUL">
<li>
<divclass="txt">Home</div>
</li>
<li>
<divclass="txt">news</div>
<ulclass="myHide">
<li><ahref="#">lastest news</a></li>
<li><ahref="#">all news</a></li>
</ul>
</li>
<li>
<divclass="txt">sports</div>
<ulclass="myHide">
<li><ahref="#">lastest news</a></li>
<li><ahref="#">all news</a></li>
</ul>
</li>
<li>
<divclass="txt">weather</div>
<ulclass="myHide">
<li><ahref="#">lastest news</a></li>
<li><ahref="#">all news</a></li>
</ul>
</li>
</ul>
</div>
</body>
</html>
标签:
折叠菜单,树形菜单
蝙蝠岛资源网 Design By www.hbtsch.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
蝙蝠岛资源网 Design By www.hbtsch.com
暂无用JS做的简单的可折叠的两级树形菜单的评论...
更新日志
2025年05月26日
2025年05月26日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]