日期:2014-05-17 浏览次数:20476 次
<head runat="server"> <title></title> <style type="text/css"> .show { display: block; width: 200px; height: 100px; border: solid 1px #ff0000; } .hide { display: none; } </style> </head> <body> <form id="form1" runat="server"> <div> <a id="operater">显示</a> <div id="showBox"> 测试 </div> </div> <script type="text/javascript"> document.getElementById("operater").onclick = function() { this.innerHTML = this.innerHTML == "显示" ? "关闭" : "显示"; var div = document.getElementById("showBox"); div.className = div.className == "show" ? "hide" : "show"; } </script> </form> </body>