jq 菜单选中状态
2016-01-05 10:21
465 查看
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style type="text/css"> body { margin: 0px; padding: 0px; } #left { width: 200px; height: 9999px; background: #f7fafc; border-right: 1px solid #e5ebf1; float: left; } #left div { height: 40px; color: #384463; font-size: 14px; line-height: 40px; border-bottom: 1px solid #f6fafd; border-top: 1px solid #f6fafd; text-align: center; } #left div:hover { background: #06C; cursor:pointer; color: #FFF } </style> </head> <body> <div id="left"> <div>导航1</div> <div>导航2</div> <div>导航3</div> <div>导航4</div> <div>导航5</div> </div> </body> <script> function js(id) { return document.getElementById(id).getElementsByTagName("div"); } for(var i=0;i<js("left").length;i++) { js("left")[i].onclick=function(){ delBackgroundColor(); this.style.background = "#06C"; this.style.color = "#fff"; } } function delBackgroundColor() { for(var i=0;i<js("left").length;i++) { js("left")[i].style.background = ''; js("left")[i].style.color = '#384463'; } } </script> </html>
相关文章推荐
- Android 引导界面制作
- Linux-查看系统版本信息
- ANDROID SHAPE画圆形背景_ANDROID实现角标布局
- Linux网络套接字
- vtune打开图形界面
- Php:学习笔记(一):版本选择
- 将博客搬至CSDN
- 关于JVM
- 找到一款不错的网站压力测试工具webbench[转载]
- [Leetcode]Trapping Rain Water
- [从头学数学] 第28节 数据收集整理
- 最终--VC中MFC如何显示位图(拉伸以及非拉伸)
- find_in_set() 函数 返回str在字符串集strlist中的序号
- 最好的C#教程和参考书
- 如何通过本地电脑连接windows和linux服务器
- 在linux环境下,如何确定是否装有双系统
- SVN使用
- Git tag 常用操作
- 欢迎使用CSDN-markdown编辑器
- tableview样式