<div class="htmlarea"> <textarea id="runcode21308"> <title>자바스크립트 드롭다운 메뉴</title> <style type="text/css"> * { padding:0; margin:0; } body { font-family:verdana, sans-serif; font-size:small; } #navigation, #navigation li ul { list-style-type:none; } #navigation { margin:20px; } #navigation li { float:left; text-align:center; position:relative; } #navigation li a:link, #navigation li a:visited { display:block; text-decoration:none; color:#000; width:120px; height:40px; line-height:40px; border:1px solid #fff; border-width:1px 1px 0 0; background:#c5dbf2; padding-left:10px; } #navigation li a:hover { color:#fff; background:#2687eb; } #navigation li ul li a:hover { color:#fff; background:#6b839c; } #navigation li ul { display:none; position:absolute; top:40px; left:0; margin-top:1px; width:120px; } #navigation li ul li ul { display:none; position:absolute; top:0px; left:130px; margin-top:0; margin-left:1px; width:120px; } </style> <ul id="navigation"> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#"> </a>열 1<ul> <li> <a href="#"></a>1열->메뉴1</li> <li> <a href="#"></a>1열->메뉴2</li> <li> <a href="#"></a>1열->메뉴3</li> <li> <a href="#"></a>1열->메뉴4</li> </ul> </li> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#"> </a>칼럼 2<ul> <li> <a href="#"></a>2열->메뉴1</li> <li> <a href="#"></a>2열->메뉴2</li> <li> <a href="#"></a>2열->메뉴3</li> <li> <a href="#"></a>2열->메뉴4</li> <li> <a href="#"></a>2열->메뉴 5</li> </ul> </li> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#"> </a>3번째 열<ul> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#"> </a>3열->메뉴 1<ul> <li> <a href="#"></a>메뉴 1->하위 메뉴 1</li> <li> <a href="#"></a>메뉴 1->하위 메뉴 2</li> <li> <a href="#"></a>메뉴 1->하위 메뉴 3</li> <li> <a href="#"></a>메뉴 1->하위 메뉴 4</li> </ul> </li> <li> <a href="#"></a>3열->메뉴 2</li> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#"> </a>3열->메뉴 3<ul> <li> <a href="#"></a>메뉴 3->하위 메뉴 1</li> <li> <a href="#"></a>메뉴 3->하위 메뉴 2</li> <li> <a href="#"></a>메뉴 3->하위 메뉴 3</li> </ul> </li> </ul> </li> </ul> </textarea> <br><input onclick="runEx('runcode21308')" type="button" value="运行代码"><input onclick="doCopy('runcode21308')" type="button" value="复制代码"> <input onclick="doSave(runcode21308)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 모두 선택 참고: </a>외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다 </div>]<script type="text/javascript"> function displaySubMenu(li) { var subMenu = li.getElementsByTagName("ul")[0]; subMenu.style.display = "block"; } function hideSubMenu(li) { var subMenu = li.getElementsByTagName("ul")[0]; subMenu.style.display = "none"; } </script>