欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

實例講解Jquery中隱藏hide、顯示show、切換toggle的用法

 更新時間:2016年05月13日 16:53:06   作者:yenga  
這篇文章主要介紹了實例講解Jquery中隱藏hide、顯示show、切換toggle的用法,感興趣的小伙伴們可以參考一下

本文實例為大家分享了jquery中show()、hide()和toggle()用法實例,供大家參考,具體內容如下

<html>
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 <title>初識jQuery</title> 
<script src="http:/www.dbjr.com.cn/jquery/1.9.0/jquery.js" type="text/javascript"></script> 
<!--引用這個jquery庫--> 
 
<style> 
#test{ 
  display:none; 
  width:120px; 
  height:50px; 
  border:1px solid blue; 
   } 
</style> 
</head> 
   
  <body> 
    <div id="test">Hello world!</div> 
    <!--設置三個按鈕,每次點擊調用特定的函數--> 
    <button onclick="sayHello()">點我打開!</button> 
    <button onclick="sayGoodbye()">點我關閉!</button> 
    <button onclick="change()">點我切換!</button> 
     
    <script type="text/javascript"> 
      function sayHello(){ 
        $("#test").show(5000); 
      <!--設參數5000,表示用5000ms的時間完成這個動作-->  
      } 
       
       function sayGoodbye(){ 
        $("#test").hide(); 
      <!--不設置,默認速度--> 
      } 
       
       function change(){ 
        $("#test").toggle("slow"); 
      <!--設置以slow的速度打開--> 
      } 
    </script> 
  </body> 
</html> 

效果圖:

以上就是本文的全部內容,希望對大家學習jquery程序設計有所幫助。

相關文章

最新評論