Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy A Table To An Array!

    Hello everyone I was just try to copy the contents of a table and put it in a multidimentional array! But for some reason it keeps rewritting over each time only returning one row! I just cant figure out what I am doing wrong its probly simple! Any help would be great! ThanX

    Code:
    var tabular=new Array();
    function copyTable(){
    	obj=document.getElementById("theTab" );
    	for(i=0,j=0;i<obj.rows.length,j<obj.rows(i).cells.length;i++,j++){
    	tabular[i]=new Array();
    	tabular[i].push(obj.rows(i).cells(j).innerText);
    	}
    	alert(tabular);
    }

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    who taught you this?
    Code:
    for(i=0,j=0;i<obj.rows.length,j<obj.rows(i).cells.length;i++,j++){
    try doing something with the following

    Code:
      var tabular=new Array();
      for(i=0;i<obj.rows.length;i++){
          tabular[i] = new Array();
          for(j=0;j<obj.rows(i).cells.length;j++){
              tabular[i][j]="blah"
          }
      }

  • #3
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Like I said it is pobly something very simple and stupid anyways thanks for your help it worked perfectly!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •