<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> #div1{width:100px; height:500px; background: aqua;} li{list-style-type: none; margin-left: 0px; text-align: left; text-indent: -20px;} li:hover{ background:red; } </style> <script type="text/javascript"> function show(){ var node=document.getElementById(‘div1‘); if(node.style.display=="block"){ node.style.display="none"; }else{ node.style.display="block"; } } </script> </head> <body> <input type="button" value="显示/隐藏" onclick="show()"> <div id="div1"> <ul> <li>php</li> <li>python</li> <li>javascript</li> <li>ruby</li> <li>php</li> </ul> </div> </body> </html>
原文:http://my.oschina.net/dongdong11019/blog/493021