乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      6月8號(hào)工作(jQuery

       一夜梨花開 2014-07-30
      今天的工作

      1、append() 方法

      Html5代碼 復(fù)制代碼 收藏代碼
      1. <!DOCTYPE html>  
      2. <html>  
      3. <head>  
      4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">  
      5. </script>  
      6. <script>  
      7. $(document).ready(function(){  
      8.   $("#btn1").click(function(){  
      9.     $("p").append(" <b>Appended text</b>.");  
      10.   });  
      11.   
      12.   $("#btn2").click(function(){  
      13.     $("ol").append("<li>Appended item</li>");  
      14.   });  
      15. });  
      16. </script>  
      17. </head>  
      18.   
      19. <body>  
      20. <p>This is a paragraph.</p>  
      21. <p>This is another paragraph.</p>  
      22. <ol>  
      23. <li>List item 1</li>  
      24. <li>List item 2</li>  
      25. <li>List item 3</li>  
      26. </ol>  
      27. <button id="btn1">追加文本</button>  
      28. <button id="btn2">追加列表項(xiàng)</button>  
      29. </body>  
      30. </html>  


      append() 方法可以將原本沒(méi)有的html通過(guò)jquery加進(jìn)去只要使用和前面同樣的class就可以在添加的瞬間完成style的設(shè)置

      2、prepend() 方法

      Html5代碼 復(fù)制代碼 收藏代碼
      1. <!DOCTYPE html>  
      2. <html>  
      3. <head>  
      4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  
      5. <script>  
      6. $(document).ready(function(){  
      7.   $("#btn1").click(function(){  
      8.     $("p").prepend("<b>Prepended text</b>. ");  
      9.   });  
      10.   $("#btn2").click(function(){  
      11.     $("ol").prepend("<li>Prepended item</li>");  
      12.   });  
      13. });  
      14. </script>  
      15. </head>  
      16. <body>  
      17.   
      18. <p>This is a paragraph.</p>  
      19. <p>This is another paragraph.</p>  
      20. <ol>  
      21. <li>List item 1</li>  
      22. <li>List item 2</li>  
      23. <li>List item 3</li>  
      24. </ol>  
      25.   
      26. <button id="btn1">添加文本</button>  
      27. <button id="btn2">添加列表項(xiàng)</button>  
      28.   
      29. </body>  
      30. </html>  


      prepend() 方法跟前面的元素添加是一樣的效果但是一樣的在于在面的方法是在默認(rèn)的到最后進(jìn)行添加但是prepend() 方法是可以在最前面開始進(jìn)行添加

      3、remove() 方法

      Html5代碼 復(fù)制代碼 收藏代碼
      1. <!DOCTYPE html>  
      2. <html>  
      3. <head>  
      4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  
      5. <script>  
      6. $(document).ready(function(){  
      7.   $("button").click(function(){  
      8.     $("#div1").remove();  
      9.   });  
      10. });  
      11. </script>  
      12. </head>  
      13.   
      14. <body>  
      15.   
      16. <div id="div1" style="height:100px;width:300px;border:1px solid black;background-color:yellow;">  
      17. This is some text in the div.  
      18. <p>This is a paragraph in the div.</p>  
      19. <p>This is another paragraph in the div.</p>  
      20. </div>  
      21.   
      22. <br>  
      23. <button>刪除 div 元素</button>  
      24.   
      25. </body>  
      26. </html>  


      remove() 方法可以把指定的元素通過(guò)remove() 方法給刪除掉在那里面就是把整個(gè)div給全部刪除掉

      4、empty() 方法

      Html5代碼 復(fù)制代碼 收藏代碼
      1. <!DOCTYPE html>  
      2. <html>  
      3. <head>  
      4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  
      5. <script>  
      6. $(document).ready(function(){  
      7.   $("button").click(function(){  
      8.     $("#div1").empty();  
      9.   });  
      10. });  
      11. </script>  
      12. </head>  
      13.   
      14. <body>  
      15.   
      16. <div id="div1" style="height:100px;width:300px;border:1px solid black;background-color:yellow;">  
      17. This is some text in the div.  
      18. <p>This is a paragraph in the div.</p>  
      19. <p>This is another paragraph in the div.</p>  
      20. </div>  
      21.   
      22. <br>  
      23. <button>清空 div 元素</button>  
      24.   
      25. </body>  
      26. </html>  


      empty() 方法同樣是刪除但是不一樣的事前者是全部刪除連div自身一起刪除但是empty() 方法不一樣empty() 方法是清空意思就是可以把指定的div里面的內(nèi)容全部清空但是會(huì)保留下當(dāng)前的div

      5、addClass() 方法

      Html5代碼 復(fù)制代碼 收藏代碼
      1. <!DOCTYPE html>  
      2. <html>  
      3. <head>  
      4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">  
      5. </script>  
      6. <script>  
      7. $(document).ready(function(){  
      8.   $("button").click(function(){  
      9.     $("#div1").addClass("important blue");  
      10.   });  
      11. });  
      12. </script>  
      13. <style type="text/css">  
      14. .important  
      15. {  
      16. font-weight:bold;  
      17. font-size:xx-large;  
      18. }  
      19. .blue  
      20. {  
      21. color:blue;  
      22. }  
      23. </style>  
      24. </head>  
      25. <body>  
      26.   
      27. <div id="div1">這是一些文本。</div>  
      28. <div id="div2">這是一些文本。</div>  
      29. <br>  
      30. <button>向第一個(gè) div 元素添加類</button>  
      31.   
      32. </body>  
      33. </html>  


      addClass() 方法是可以通過(guò)jquery直接向一個(gè)沒(méi)有class的標(biāo)簽里面添加進(jìn)入一個(gè)帶有屬性的class在里面在點(diǎn)擊按鈕以后原來(lái)的第二行文字會(huì)發(fā)生變化對(duì)應(yīng)$("#div1").addClass("important blue");這條語(yǔ)句的意思是變成藍(lán)色加大

      6、removeClass() 方法

      Html5代碼 復(fù)制代碼 收藏代碼
      1. <!DOCTYPE html>  
      2. <html>  
      3. <head>  
      4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>  
      5. <script>  
      6. $(document).ready(function(){  
      7.   $("button").click(function(){  
      8.     $("h1,h2,p").removeClass("blue");  
      9.   });  
      10. });  
      11. </script>  
      12. <style type="text/css">  
      13. .important  
      14. {  
      15. font-weight:bold;  
      16. font-size:xx-large;  
      17. }  
      18. .blue  
      19. {  
      20. color:blue;  
      21. }  
      22. </style>  
      23. </head>  
      24. <body>  
      25.   
      26. <h1 class="blue">標(biāo)題 1</h1>  
      27. <h2 class="blue">標(biāo)題 2</h2>  
      28. <p class="blue">這是一個(gè)段落。</p>  
      29. <p>這是另一個(gè)段落。</p>  
      30. <br>  
      31. <button>從元素上刪除類</button>  
      32. </body>  
      33. </html>  


      removeClass() 方法是可以將原本字體的藍(lán)色給刪除掉不是改變是刪除掉

      7、toggleClass() 方法

      Html5代碼 復(fù)制代碼 收藏代碼
      1. <!DOCTYPE html>  
      2. <html>  
      3. <head>  
      4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">  
      5. </script>  
      6. <script>  
      7. $(document).ready(function(){  
      8.   $("button").click(function(){  
      9.     $("h1,h2,p").toggleClass("blue");  
      10.   });  
      11. });  
      12. </script>  
      13. <style type="text/css">  
      14. .blue  
      15. {  
      16. color:blue;  
      17. }  
      18. </style>  
      19. </head>  
      20. <body>  
      21.   
      22. <h1>標(biāo)題 1</h1>  
      23. <h2>標(biāo)題 2</h2>  
      24. <p>這是一個(gè)段落。</p>  
      25. <p>這是另一個(gè)段落。</p>  
      26. <button>切換 CSS 類</button>  
      27. </body>  
      28. </html>  


      toggleClass() 方法有著上面兩種效果在沒(méi)有藍(lán)色的字體上加上藍(lán)色在有藍(lán)色的字體上清除藍(lán)色

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約