<div class="codetitle"> <span><a style="CURSOR: pointer" data="51696" class="copybut" id="copybut51696" onclick="doCopy('code51696')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code51696"> <br><span style="font-size:14px;"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><meta http-equiv="content-type" content="texthtml;charset=utf-8"> <br><title>메뉴</title> <br><style type="text/css"> <br>#nav <br>{ <br>목록 스타일: 없음; <br>텍스트 정렬: 가운데; <br>} <br>#nav li <br>{ <br>float: 왼쪽; <br>너비: 100px; <br>색상: 흰색; <br>배경색: #3E3E3E; <br>} <br>#menu <br>{ <br>목록 스타일: 없음; <br>패딩: 5px; <br>디스플레이: 없음; <br>왼쪽 여백: -5px; <br>여백 상단: -5px; <br>} <br>#메뉴 리 <br>{ <br>배경색: #ccc; <br>너비: 100px; <br>텍스트 정렬: 왼쪽; <br>왼쪽 여백: 10px; <br>} <br>#menu li a:link <br>{ <br>텍스트 장식: 없음; <br>디스플레이: 블록; <br>} <br>#menu li a:hover <br>{ <br> background-color:#3E3E3E; <br>색상: 흰색 <br>} <br></style> <br></head> <br><본문> <br><ul id="nav"> <br><li class="child">数 据 库 <br><ul id="menu"> <br><li><a href="http://blog.csdn.net/u011043843">MySQL</a></li> <br><li><a href="http://blog.csdn.net/u011043843">SQL 서버</a></li> <br><li><a href="http://blog.csdn.net/u011043843">Oracle</a></li> <br><li><a href="http://blog.csdn.net/u011043843">DB2</a></li> <br></ul> <br></li> <br><li class="child">前台脚本 <br><ul id="menu"> <br><li><a href="http://blog.csdn.net/u011043843">자바스크립트</a></li> <br><li><a href="http://blog.csdn.net/u011043843">루비</a></li> <br><li><a href="http://blog.csdn.net/u011043843">HTML</a></li> <br><li><a href="http://blog.csdn.net/u011043843">Python</a></li> <br></ul> <br></li> <br><li class="child">后台脚本 <br><ul id="menu"> <br><li><a href="http://blog.csdn.net/u011043843">PHP</a></li> <br><li><a href="http://blog.csdn.net/u011043843">ASP</a></li> <br><li><a href="http://blog.csdn.net/u011043843">ASP.NET</a></li> <br><li><a href="http://blog.csdn.net/u011043843">JSP</a></li> <br></ul> <br></li> <br></ul> <br><script type="text/javascript"> <br>var lis = document.getElementById("nav").getElementsByTagName('li'); <br>var i = 0; <br><br>for( i = 0; i < lis.length; i ) <BR>{ <BR>if(lis[i].className == "child") <BR>{ <BR>lis [i].onmouseover = function() <BR>{ <BR>var ulObj1 = this.getElementsByTagName('ul')[0]; <BR>ulObj1.style.display = "차단"; <BR>this.style.BackgroundColor="#ccc"; <BR>this.style.color="검은색"; <BR>} <BR>} <br><br>lis[i].onmouseout = function() <BR>{ <BR>var ulObj1 = this.getElementsByTagName('ul')[0]; //this是HTMLElement对象 <BR>ulObj1.style.display = "none"; <BR>this.style.BackgroundColor="#3E3E3E"; <BR>this.style.color="흰색"; <BR>} <BR>} <br><br></script> <br></body> <br></html></span> <br> </div>