回覆列表
  • 1 # 不冷的臥

    <script language="javascript" type="text/javascript">var arr1 = [[30,-1,90],[70,100,-40],[39,29,6],[39,92,9]];var arr2 = [];//確定新陣列有多少行for(var i=0;i<arr1[0].length;i++){arr2[i] = [];}//動態新增資料//遍歷原陣列for(var i=0;i<arr1.length;i++){for(var j=0;j<arr1[i].length;j++){arr2[j][i] = arr1[i][j];}}//列印新陣列for(var i=0;i<arr2.length;i++){for(var j=0;j<arr2[i].length;j++){document.writeln(arr2[i][j]);}document.write("<br />");}</script>

  • 中秋節和大豐收的關聯?
  • 萬家樂和萬和哪個好用質量好?