<div class="codetitle"> <span><a style="CURSOR: pointer" data="98893" class="copybut" id="copybut98893" onclick="doCopy('code98893')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code98893"> <br><!DOCTYPEhtml PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html> <br><hrad> <br><metahttp-equiv="content-type"content="text/html;charset=utf-8"> <br><title>可折叠的两级菜单</title> <br><styletype="text/css"> <br><!-- <BR>body{ <BR> background-color:#ffdee0; <BR>} <BR>#navigation { <BR>너비:200px; <BR>글꼴군:Arial; <BR>} <BR>#navigation > ul { <br>목록 스타일 유형:없음; <br>여백:0px; <br>패딩:0px; <br>} <br>#navigation > ul >li { <br>border-bottom:1pxsolid #ED9F9F; <br>} <br>#navigation > ul >li > a{ <br>디스플레이:블록; <br>패딩:5px5px 5px 0.5em; <br>텍스트 장식:없음; <br>경계 왼쪽:12pxsolid #711515; <br>국경 오른쪽:1pxsolid #711515; <br>} <br>#navigation > ul >li > a:link, #navigation >ul >li > a:방문함{ <br>배경색:#c11136; <br>색상:#FFFFFF; <br>} <br>#navigation > ul >li > a:hover{ <br>배경색:#990020; <br>색상:#ffff00; <br>} <br>.txt{ <br>배경색:#c11136; <br>색상:#FFFFFF; <br>패딩:5px5px 5px 0.5em; <br>텍스트 장식:없음; <br>경계 왼쪽:12pxsolid #711515; <br>국경 오른쪽:1pxsolid #711515; <br>} <br><br>/* 子菜单적 CSS样式 */ <br>#navigation ul li ul{ <br>list-style-type:none; <br>여백:0px; <br>패딩:0px0px 0px 0px; <br>} <br>#navigation ul li ulli{ <br>border-top:1pxsolid #ED9F9F; <br>} <br>#navigation ul li ulli a{ <br>display:block; <br>패딩:3px3px 3px 0.5em; <br>텍스트 장식:없음; <br>경계 왼쪽:28pxsolid #a71f1f; <br>국경 오른쪽:1pxsolid #711515; <br>} <br>#navigationul li ulli a:link, #navigationul li ul lia:visited{ <br> background-color:#e85070; <br>색상:#FFFFFF; <br>} <br>#navigation ul li ulli a:hover{ <br> background-color:#c2425d; <br>색상:#ffff00; <br>} <br>#navigation ul li ul.myHide{ /* 隐藏子菜单 */ <br>display:none; <br>} <br>#navigation ul li ul.myShow{ /* 显示子菜单 */ <br>display:block; <br>} <br>--> <br></style> <br><script언어="javascript"> <br>window.onload=function(){ <br>varlistUL=document.getElementById("listUL"); <br>varolist=listUL.childNodes; <br>바로아=0; <br>for(var i = 0; i < olist.length; i ) { <BR>if(olist[i].tagName=="LI"&&olist[i].getElementsByTagName("ul")[0] ){ <BR>oa=olist[i]; <BR>oa.onclick=변경; <BR>} <br><br>} <BR>functionchange(){ <BR>varos=this.getElementsByTagName("ul")[0]; <BR>if(os.className=="myHide") <BR>os.className="myShow"; <BR>그 외 <BR>os.className="myHide"; <BR>} <BR>} <BR></script> <br></hrad> <br><본문> <br><divid="navigation"> <br><ulid="listUL"> <br><li> <br><divclass="txt">홈</div> <br></li> <br><li> <br><divclass="txt">뉴스</div> <br><ulclass="myHide"> <br><li><ahref="#">최신 뉴스</a></li> <br><li><ahref="#">모든 뉴스</a></li> <br></ul> <br></li> <br><li> <br><divclass="txt">스포츠</div> <br><ulclass="myHide"> <br><li><ahref="#">최신 뉴스</a></li> <br><li><ahref="#">모든 뉴스</a></li> <br></ul> <br></li> <br><li> <br><divclass="txt">날씨</div> <br><ulclass="myHide"> <br><li><ahref="#">최신 뉴스</a></li> <br><li><ahref="#">모든 뉴스</a></li> <br></ul> <br></li> <br></ul> <br></div> <br></body> <br></html> <br> </div>