1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 2 3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 <html xmlns="http://www.w3.org/1999/xhtml"> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 7 <title>无标题文档</title> 8 9 <script type="application/javascript" src="js/jquery-1.11.3.js"> 10 11 </script> 12 13 <script type="application/javascript"> 14 $(document).ready(function(){ 15 16 $('#hide').click(function(){$('p').hide();}); 17 $('#show').click(function(){$('p').show();}); 18 19 } 20 ) 21 22 23 24 25 </script> 26 27 </head> 28 29 <body> 30 31 <p>冒险</p> 32 33 <input id="hide" type="button" value="隐藏" /> 34 35 36 <input id="show" type="button" value="显示" /> 37 38 39 <p>显示的内容</p> 40 <p class="a">显示的内容2</p> 41 <div class="a">div标签</div> 42 43 44 <input id="hide" onclick="$(this).click($('.a').fadeToggle(2000))" 45 46 type="button" value="隐藏" /> 47 48 <input id="show" onclick="$(this).click($('.a').show())" type="button" 49 50 value="显示" /> 51 52 </body> 53 </html>