<script type="text/javascript">
var
arr=[[1,2,3],[4,5,6],[7,8,9],[17,18,19]];
var
arr2=new Array();
var
alen=arr.length;
var
blen=arr[0].length;
for(var
i=0;i<arr.length;i++)
{
for(var
j=0;j<arr[0].length;j++){
document.write(arr[i][j]);
document.write(" ");
}
document.write("<br/>");
}
document.write("*****************************<br/>")
for(var
i=0;i<blen;i++)
{
arr2[i]=new
Array();
for(var
j=0;j<alen;j++)
{
arr2[i][j]=0;
}
}
for(var
i=0;i<alen;i++)
{
for(var j=0;j<blen;j++){
arr2[j][i]=arr[i][j];
}
}
for(var
i=0;i<arr2.length;i++)
{
for(var
j=0;j<arr2[0].length;j++){
document.write(arr2[i][j]);
document.write(" ");
}
document.write("<br/>");
}
</script>