1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 <script type="text/javascript" src="D:/jquery2.0/jquery-2.0.0.js"></script> 7 <script type="text/javascript"> 8 $(document).ready(function(){ 9 alert("Hello"); 10 }); 11 </script> 12 <script type="text/javascript"> 13 $(document).ready(function(){ 14 var $cr = $("#cr"); 15 var cr = $cr[0]; 16 $cr.click(function(){ 17 if(cr.checked){ 18 alert("Thank You!"); 19 } 20 }) 21 }); 22 </script> 23 <script type="text/javascript"> 24 $(document).ready(function(){ 25 var cr = document.getElementById("cr"); 26 var $cr = $(cr); 27 $cr.click(function(){ 28 if($cr.is(":checked")){ 29 alert("Hello,World!"); 30 } 31 }) 32 }); 33 </script> 34 </head> 35 <body> 36 <input type="checkbox" class="cr" id="cr"/><label for="cr">您同意上面的条款吗?</label> 37 </body> 38 </html>
昨天晚上学习的jQuery对象和DOM对象之间的转换,感觉还可以,不是很困难。感觉jQuery比JS更好用一点。
Never Give Up!