jQuery小结1

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4     <title></title>
 5     <style type="text/css">
 6         *{margin:0px;padding:0px;}
 7         body{font-size:12px;}
 8         
 9         .box{margin:10px;padding:10px;}
10         .box h3{margin:10px 0px;border-bottom:1px solid red;padding-bottom:10px;}
11         .box p{line-height:20px;}
12         
13         #excelbox{width:800px;border-collapse:collapse;margin:20px;}
14         #excelbox tr{height:30px;}
15         #excelbox tr td{border:1px solid #aaccff;}
16         #excelbox tr td.focus{border:1px solid red;}
17         #excelbox tr td input{border:none;width:99%;height:30px;line-height:30px;}
18     </style>
19     <script type="text/javascript">
20 
21         function add(){
22             var sum=0;
23             for(var i=1;i<=100;i++){
24                 if(i%3==0){
25                     sum+=i;
26                 }
27             }
28             alert(sum);
29         }
30     </script>
31 </head>
32 <body>
33     <div class="box">
34         <h3>试题要求</h3>
35         <p>
36             1.使用javascript计算100以内,能够被3整除的数字之和。<br />
37             <input type="button" value="点击一下,获取100以内能够被3整除的数字之和" onclick="add()" />
38         </p>
39     </div>
40 </body>
41 </html>

 

posted on 2015-12-13 22:25  guanzhenqiang  阅读(92)  评论(0编辑  收藏  举报

导航