[javascript]JavaScript实现鼠标移动改变样式
操作方法
- 01
样式设置: <style type="text/css"> .sec_menu { border-right: white 1px solid; padding-right: 2px; padding-left: 2px; background: #d6dff7; padding-bottom: 5px; border-left: white 1px solid; padding-top: 5px; border-bottom: white 1px solid; } .menu_title { background-color: #AABFEC; } .menu_title SPAN { font-weight: bold; left: 8px; color: #215dc6; position: relative; top: 2px; } .menu_title2 { } .menu_title2 SPAN { font-weight: bold; left: 8px; color: #428eff; position: relative; top: 2px; } </style> <script language="javascript" type="text/javascript">//实现单击隐藏 function menuChange(obj,menu) { if(menu.style.display=="none") { menu.style.display=""; } else { menu.style.display="none"; } } </script> html实例代码: <table cellpadding="0" cellspacing="0" width="168" align="center"> <tr style="cursor: hand">//栏目头 <td height="25" class="menu_title" onmouseover="this.className='menu_title2';" onmouseout="this.className='menu_title';" onclick="menuChange(this,menu1);"> <span style="z-index: 101">文章信息管理</span> </td> </tr> <tr>//栏目内容列表 <td> <div class="sec_menu" id="menu1" style="display :none ;"> ............ ............ </div> </td> </tr> </table> #Html