<div class="htmlarea"> <textarea id="runcode47924"> <meta name="Author" content="Ma Jia Nan"> <meta name="Date" content="2008-12-7"> <meta name="Description" content=""> <title>Menu</title> <style type="text/css"> #menubar { font-family:verdana; font-size:12px; margin:1px; } #menubar li { float:left; position:relative; text-align:left; } /* each menu item style */ #menubar li a { border-style:none; color:black; display:block; width:150px; height:20px; line-height:20px; padding-left:10px; text-decoration:none; } /* the first level menu which displays default */ #menubar .menuMain{ border-color:#C0C0C0; border-width:1px; border-style:solid; } /* the first leve style when mouse on it */ #menubar li a:hover{ background-color:#efefef; text-decoration:underline; } /* the second level menu block style */ #menubar li ul{ background-color:#efefef; border-style:none; display:none; position:absolute; top:20px; left:-40px; margin-top:2px; width:150px; } /* the sub menu item style when mouse on it */ #menubar li ul li a:hover { text-decoration:underline; padding-left:20px; } /* the third or more level menu block style */ #menubar li ul li ul { display:none; position:absolute; top:0px; left:150px; margin-top:0; margin-left:0; width:150px; } </style> <script language="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> <div> <ul id="menubar"> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#" class="menuMain">File</a> <ul> <li><a href="#">New</a></li> <li><a href="#">Open</a></li> <li><a href="#">Save</a></li> <li><a href="#">Save As</a></li> <li><a href="#">Close</a></li> </ul> </li> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#" class="menuMain">Edit</a> <ul> <li><a href="#">Cut</a></li> <li><a href="#">Copy</a></li> <li><a href="#">Paset</a></li> <li><a href="#">Delete</a></li> <li><a href="#">Select All</a></li> </ul> </li> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#" class="menuMain">View</a> <ul> <li onmouseover="displaySubMenu(this)" onmouseout="hideSubMenu(this)"> <a href="#">View List</a> <ul> <li><a href="#">Tool Bar</a></li> <li><a href="#">State Bar</a></li> <li><a href="#">Function List</a></li> <li><a href="#">Label List</a></li> </ul> </li> <li><a href="#">Show Line Number</a></li> <li><a href="#">Set Color</a></li> </ul> </li> </ul> </div> </textarea><br><input onclick="runEx('runcode47924')" type="button" value="运行代码"> <input onclick="doCopy('runcode47924')" type="button" value="复制代码"> <input onclick="doSave(runcode47924)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>