Deleting cells by name instead of index?

Discussion in 'HTML' started by Rich Morey, Jun 5, 2004.

  1. Rich Morey

    Rich Morey Guest

    Hi,

    I have a table where I am altering the layout via javascript to create
    colspans. I want to then delete the "Extra" cells created by the
    colspans.

    I have named the cells "r1c1", "r1c2", "r2c1", etc..

    document.getElementById('r2c2').colSpan="4"
    cellRows = document.getElementById('tableChart').rows(1);
    cellRows.deleteCell(2);
    cellRows.deleteCell(2);
    cellRows.deleteCell(2);

    document.getElementById('r2c7').colSpan="4"
    cellRows = document.getElementById('tableChart').rows(1);
    cellRows.deleteCell(4);
    cellRows.deleteCell(4);
    cellRows.deleteCell(4);

    This code works because when I'm working on r2c7, I know that I've
    already deleted three cells above and so the next cells to delete are
    column index of 4.. but what I'd like to be able to do is delete the
    cells by name, in this case
    'r2c8', 'r2c9', and 'r2c10'

    Is there anyway to do that? I tried just

    document.getElementById('r2c8').deleteCell()

    but that gave me a javascript error..

    Thanks,

    Rich
     
    Rich Morey, Jun 5, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    561
  2. Seb
    Replies:
    4
    Views:
    409
  3. Joel Finkel

    Cells[].Text or Cells[].Controls[0]

    Joel Finkel, Sep 1, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    344
    Joel Finkel
    Sep 1, 2003
  4. Rich Morey

    Deleting cells by name instead of index?

    Rich Morey, Jun 5, 2004, in forum: Javascript
    Replies:
    6
    Views:
    185
    Rich Morey
    Jun 8, 2004
  5. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    357
    Tomasz Chmielewski
    Mar 4, 2008
Loading...

Share This Page