qq_s_153
2018-07-19 09:19
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>二维数组</title>
<script type="text/javascript">
var myarr=new Array();
for( var i=0;i<3;i++){
myarr[i]= new Array();
for(var j=0;j<6;j++){
myarr[i][j]=(i+1)*(j+1);
if(myarr[i][j]<10){
myarr[i][j] ="0"+myarr[i][j];
}
}
}
for(var i=0;i<3;i++){
for(var j=0;j<6;j++){
document.write(myarr[i][j]+" ");
}
document.write("<br>");
}
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>二维数组</title> <script type="text/javascript"> var myarr = new Array(); for (var i = 0; i < 3; i++){ myarr[i] = new Array() for (var j = 0; j < 6; j++){ myarr[i][j] = i * j; document.write(myarr[i][j] + " "); } document.write("<br>"); } </script> </head> <body> </body> </html>
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>二维数组</title><script type="text/javascript"> var num=new Array();//先声明一维数组 for(var i=0;i<3;i++){ num[i]=new Array(); for(var j=0;j<6;j++){ num[i][j]=i*j; document.write(num[i][j]+" "); } document.write("<br>") } </script></head><body></body></html>
JavaScript进阶篇
468065 学习 · 21891 问题
相似问题