日期:2014-05-16 浏览次数:20310 次
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script src="http://code.jquery.com/jquery-latest.js"></script> <style type="text/css"> .head1 { text-align: center; font-size: 20px; height: 30px; line-height: 30px; width: 200px; background-color: Yellow; cursor: pointer; } .head2 { text-align: left; font-size: 20px; height: 30px; line-height: 30px; width: 200px; background-color: Aqua; cursor: pointer; } </style> <script type="text/javascript"> $(document).ready(function () { $("#head").toggle(function () { $(this).removeClass("head1").addClass("head2"); $("#body").slideDown(); }, function () { $(this).removeClass("head2").addClass("head1"); $("#body").slideUp(); }); }); </script> <title></title> </head> <body> <form id="form1" runat="server"> <div> <div id="head" class="head1"> 点击 </div> <div id="body" style="height: 200px; width: 200px; display: none; background-color: Red;"> </div> </div> </form> </body> </html>