为什么执行不了?
用按钮的方法就无法将数组显示,这是为什么呢?
2015-08-19
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>二维数组</title> <script type="text/javascript"> function show() { var myarr=new Array(); for(var i=0;i<2;i++) { myarr[i]=new Array(); for(var j=0;j<3;j++) { myarr[i][j]=i*j; document.write("myarr["+i+"]["+j+"]的值:"+myarr[i][j]+"<br>"); } } } </script> </head> <body> <input type="button" value="点击显示二维数组" onclick="show()" </body> </html>
举报