版权声明:转载原创文章请以超链接形式请注明原文章出处,尊重作者,尊重原创!
恰饭广告
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Document</title> <style type="text/css"> div, span, p { width: 140px; height: 140px; margin: 5px; background: #bbb; border: #000 1px solid; float: left; font-size: 17px; font-family: Verdana; } div.mini { width: 55px; height: 55px; background-color: #bbb; font-size: 12px; } div.hide { display: none; } </style> </head> <body> <input type="button" value="选择 id为 one 的元素." id="btn1" /><input type="button" value="选择 class 为 mini 的所有元素." id="btn2" /><input type="button" value="选择 元素名是 div 的所有元素." id="btn3" /><input type="button" value="选择 所有的元素." id="btn4" /><input type="button" value="选择 所有的span元素和id为two的元素." id="btn5" /><input type="button" value="清除" id="btn6" /><br /><br /> <div class="one" id="one">id为one, class为one的div <div class="mini">class为mini</div> </div> <div class="one" id="two" title="test">id为two, class为one, title为test的div. <div class="mini" title="other">class为mini, title为other </div> <div class="mini" title="test">class为mini, title为test </div> </div> <div class="one"> <div class="mini">class为mini</div> <div class="mini">class为mini</div> <div class="mini">class为mini</div> <div class="mini"></div> </div> <div class="one"> <div class="mini">class为mini</div> <div class="mini">class为mini</div> <div class="mini">class为mini</div> <div class="mini" title="tesst">class为mini, title为tesst </div> </div> <div style="display:none;" class="none">style的display为"none"的div </div> <div class="hide">class为"hide"的div</div> <div>包含input的type为"hidden"的div<input type="hidden" size="8" /></div><span id="mover">正在执行动画的span元素.</span> <script type="text/javascript" src="jquery-3.2.1.js"></script> <script> $(document).ready(function(){ $('#btn1').click(function(){ $('#one').css({"background":"red"}); }); }); $(document).ready(function(){ $('#btn2').click(function(){ $('.mini').css({"background":"red"}); }); }); $(document).ready(function(){ $('#btn3').click(function(){ $('div').css({"background":"red"}); }); }); $(document).ready(function(){ $('#btn4').click(function(){ $('div,span').css({"background":"red"}); }); }); $(document).ready(function(){ $('#btn5').click(function(){ $('span,#two').css({"background":"red"}); }); }); $(document).ready(function(){ $('#btn6').click(function(){ $('span,div').css({"background":"#bbb"}); }); }); </script> </body> </html>
原文链接:https://www.idaobin.com/archives/236.html
让我恰个饭吧.ヘ( ̄ω ̄ヘ)
恰饭广告