标签:北京科技 script span 学生 最大 break log 开始 doctype
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 <!--<script type="text/javascript"> 9 var arr = [1,20,18,44,66,21];//求数组中的最大值 10 var arr_max = arr[0];//假设下标为0的第一位数1为最大值 11 var arr_length = arr.length;//得到长度 12 for(var i=0;i<arr_length;i++){ 13 //i=0,从下标为0开始,即第一位数 //数组的遍历,数组的长度arr_length 14 if(arr_max < arr[i]){ //<求最大值 >求最小值 15 //如果arr_max这个值比数组中的其他元素的值小,则 16 arr_max = arr[i]; //赋值 17 }//循环,直到得出最大值66 18 } 19 document.write("最大值为:"+arr_max); 20 </script>--> 21 <!--<script type="text/javascript"> 22 function HelloWorld (m,n) { 23 var str = "<table width=‘600‘ border=‘1‘ align=‘center‘>"; 24 for(var i=1;i<=m;i++){ 25 str += "<tr>"; 26 for(var j=1;j<=n;j++){ 27 str += "<td> </td>"; 28 } 29 str += "<tr>"; 30 } 31 str += "</table>" 32 document.write(str+"<hr/>"); 33 } 34 HelloWorld(9,9); 35 HelloWorld(15,15); 36 HelloWorld(6,15); 37 </script>--> 38 <script type="text/javascript"> 39 var arr = [ 40 ["周更生","男",30,true,"大专",5000,500,,"山东省"], 41 ["刘晓庆","女",26,false,"研究生",8000,1500,"北京科技大学","山西省"], 42 [" 李大大","男",38,true,"大专",1000,250,"清华大学","陕西省"], 43 ["李强","女",34,true,"高中",11000,30,"河北大学","江苏省"], 44 ]; 45 46 var arr_length = arr.length; 47 var str="<table width=‘600‘ align=‘center‘ border=‘1‘ style=‘border-collapse:collapse‘>"; 48 str +="<caption>学生信息</caption>"; 49 for(var i=0;i<=arr_length;i++){ 50 str+="<tr>"; 51 for(var j=0; j<arr[i].length;j++){ 52 str += "<td>"+arr[i][j]+"</td>"; 53 } 54 55 str += "</tr>"; 56 } 57 58 str += "</table>"; 59 document.write(str); 60 61 </script> 62 </body> 63 </html>
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 <script type="text/javascript"> 9 for(var num=1;num<=100;num++){ 10 var count = 0; 11 for(var i=1;i<=num;i++){ 12 if(num % i == 0){ 13 count++; 14 } 15 } 16 if(count == 2){ 17 document.write(num+" 是质数<br/>"); 18 } 19 } 20 </script>--> 21 <script type="text/javascript"> 22 for(var i=1;i<100;i++){ 23 if(i>50){ 24 break; 25 } 26 document.write(i+"<br>"); 27 } 28 for(name in window){ 29 document.write(name+"<br>"); 30 } 31 var a = function(a){ 32 return a*a*a; 33 } 34 document.write(a(10)); 35 function getSum (a,b,c) { 36 return a+b+c; 37 } 38 document.write(getSum(10,20,30));*/ //求三个值的和 39 </script> 40 <script type="text/javascript"> 41 var houdu = 0.01/1000; 42 for(var i=1;i<=30;i++){ 43 houdu =houdu*2; 44 if(houdu>1 && houdu<2){ 45 document.write("一张纸对折"+i+"次后,就超过1米厚了<br/>"); 46 } 47 } 48 document.write("则该纸对折30次后是多厚"+houdu+"米") ; 49 50 </script>--> 51 <script type="text/javascript"> 52 function counte (a,b) { 53 var cha=a-b; 54 var ji=a*b; 55 var he=a+b; 56 var chu=a/b; 57 return [cha,ji,he,chu]; 58 59 } 60 document.write("差,积,和,除分别为:"+counte(20,10)); 61 </script> 62 </body> 63 </html>
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body><script type="text/javascript">for(var num=1;num<=100;num++){var count = 0;for(var i=1;i<=num;i++){if(num % i == 0){count++;}}if(count == 2){document.write(num+" 是质数<br/>");}}</script>--><script type="text/javascript">for(var i=1;i<100;i++){if(i>50){break;}document.write(i+"<br>");} for(name in window){document.write(name+"<br>");}var a = function(a){return a*a*a;}document.write(a(10));function getSum (a,b,c) { return a+b+c; }document.write(getSum(10,20,30));*/ //求三个值的和</script><script type="text/javascript">var houdu = 0.01/1000;for(var i=1;i<=30;i++){houdu =houdu*2;if(houdu>1 && houdu<2){document.write("一张纸对折"+i+"次后,就超过1米厚了<br/>");}}document.write("则该纸对折30次后是多厚"+houdu+"米");</script>--><script type="text/javascript">function counte (a,b) { var cha=a-b; var ji=a*b; var he=a+b; var chu=a/b; return [cha,ji,he,chu]; }document.write("差,积,和,除分别为:"+counte(20,10));</script></body></html>
标签:北京科技 script span 学生 最大 break log 开始 doctype
原文地址:http://www.cnblogs.com/li3207820480/p/6143413.html