<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
list-style: none;
} .all {
width: 330px;
height: 30px;
background: url(img/bg.jpg) no-repeat;
margin: 100px auto;
line-height: 30px;
text-align: center;
padding-left: 10px;
margin-bottom: 0;
} .all ul li {
width: 100px;
height: 30px;
background: url(img/libg.jpg);
float: left;
margin-right: 10px;
position: relative;
cursor: pointer;
} .all ul ul {
position: absolute;
left: 0;
top: 30px;
display: none;
}
</style>
</head> <body>
<div class="all">
<ul id="list">
<li>一级菜单
<ul>
<li>二级菜单</li>
<li>二级菜单</li>
<li>二级菜单</li>
</ul>
</li>
<li>一级菜单
<ul>
<li>二级菜单</li>
<li>二级菜单</li>
<li>二级菜单</li>
</ul>
</li>
<li>一级菜单
<ul>
<li>二级菜单</li>
<li>二级菜单</li>
<li>二级菜单</li>
</ul>
</li>
</ul>
</div>
</body> </html>
<script>
window.onload = function () {
new ListMenu().init();
} function ListMenu() {
this.list = list.children;
this.init = function () {
for (let i = 0; i < this.list.length; i++) {
this.list[i].onmouseenter = function () {
this.show(this.list[i].children[0]);
}.bind(this)
this.list[i].onmouseleave = function () {
this.hide(this.list[i].children[0]);
}.bind(this)
}
}
this.show = function (obj) {
obj.style.display = "block";
}
this.hide = function (obj) {
obj.style.display = "none";
}
}
</script>

最新文章

  1. iOS之延时执行(睡眠)的几种方法
  2. UITextField set placeholderColor and UITextField set clearButton Image
  3. logo
  4. [USACO2003][poj2138]Travel Games(dp/最长路)
  5. 定制linux中的Gtk theme&lt;一&gt;如何设置窗口按钮的多态效果
  6. poj 1113Wall
  7. 201521123011《Java程序设计》第10周学习总结
  8. 重新编译Linux内核必要性及其准备工作
  9. Mysql-5.7.21安装配置
  10. JS-4-if
  11. nginx 配置说明
  12. 第一次使用cisco packet tracer
  13. SpringBoot集成前端模版(thymeleaf)
  14. javascript功能插件大集合,写前端的亲们记得收藏
  15. JS 时间 获取 当天,昨日,本周,上周,本月,上月
  16. Android解析WindowManagerService(二)WMS的重要成员和Window的添加过程
  17. 手动安装Chrome截屏控件扩展-Xproer.ScreenCapture(ScreenCapture.crx)
  18. JavaScript 递归法排列组合二维数组2
  19. 3.Write Scripts for the mongo Shell-官方文档摘录
  20. 线段树——hdu1754I Hate It

热门文章

  1. Linq中类型转换
  2. [python][matlab]使用python调用matlab程序
  3. IE8 disable 兼容行问题
  4. angular之表达式
  5. VSTO 基础随笔
  6. OO Unit 1 表达式求导
  7. Java对象转换成Map
  8. 2018-2019-2 网络对抗技术 20162329 Exp4 恶意代码分析
  9. [HEOI/TJOI2016]序列
  10. 操作redis数据库 &amp; 操作Excel &amp; 开发接口