Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #20273

Re: Prob with IE8 and getElementsByName()

From "Mel Smith" <med_cutout_syntel@aol.com>
Newsgroups comp.lang.javascript
Subject Re: Prob with IE8 and getElementsByName()
Date 2013-06-13 08:41 -0600
Message-ID <b1u40iFb16oU1@mid.individual.net> (permalink)
References <b1pkhiFc1amU1@mid.individual.net><51b86558$0$6630$9b4e6d93@newsspool2.arcor-online.net><b1rfdhFntnvU1@mid.individual.net> <kpc3ge$j0k$1@dont-email.me>

Show all headers | View raw


Denis said:

> Don't forget that you can refine the selection repeatedly.
>
> eg select a specific table, then select all the rows, skip however many
> rows contain headers, then start working through the data rows and the
> cells in each data row
>
> So instead of document.getElementsByTagName you could:
>
> cells = document.getElementsById("table_id").getElementsByTagName("td");
>
> to get all the td cells in a specific table
>
> Although you may want to work through them row by row:
>
> rows = document.getElementsById("table_id").rows;
> a = // number of header rows in this table
> for ( i = a; i < rows.length; i++ ) {
> cells = rows.item(i).cells;
> for ( j = 0; j < cells.length; j++ ) {
> // cell number in data area, 0 index:
> cellNum = ( i - a ) * cells.length + j;
> // do something with cell here
> }
> }


Hi Denis (and others):

    Did some JS reading last nite (David Flanagan's 5th), and am going to 
make some changes to the way I implement the 5th table this morning:

    Because this table has a variable number of rows -- from 1 thru (I 
think) ten or so maximum,  and because I don't know the size of the table 
until my Ajax routine returns the response string of values for the rows and 
columns, I will now try to build the table in 'real time' as I parse the 
Ajax response.

    What I will do is prebuild only the <thead> section, then I'll add the 
<tr> rows and cells as I parse thru the responsetext..

    I haven't done this before but Flanagan explains the syntax of 
insertRow(), and insertCell(), and I'm going to give it a try.

    If it doesn't work out, I still have your guidance above to rescue me 
:))

Thanks !

-Mel

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Prob with IE8 and getElementsByName() "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-11 15:52 -0600
  Re: Prob with IE8 and getElementsByName() Andrew Poulos <ap_prog@hotmail.com> - 2013-06-12 11:01 +1000
  Re: Prob with IE8 and getElementsByName() Martin Honnen <mahotrash@yahoo.de> - 2013-06-12 14:11 +0200
    Re: Prob with IE8 and getElementsByName() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-12 16:33 +0200
    Re: Prob with IE8 and getElementsByName() "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-12 08:37 -0600
      Re: Prob with IE8 and getElementsByName() Andrew Poulos <ap_prog@hotmail.com> - 2013-06-13 08:36 +1000
        Re: Prob with IE8 and getElementsByName() "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-12 16:59 -0600
      Re: Prob with IE8 and getElementsByName() Denis McMahon <denismfmcmahon@gmail.com> - 2013-06-13 09:30 +0000
        Re: Prob with IE8 and getElementsByName() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-13 13:12 +0200
        Re: Prob with IE8 and getElementsByName() "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-13 08:41 -0600
          Re: Prob with IE8 and getElementsByName() "Mel Smith" <med_cutout_syntel@aol.com> - 2013-06-13 14:12 -0600
            Re: Prob with IE8 and getElementsByName() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-06-13 23:43 +0200
              Re: Prob with IE8 and getElementsByName() Tim Streater <timstreater@greenbee.net> - 2013-06-13 23:19 +0100
                Re: Prob with IE8 and getElementsByName() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-06-14 00:34 +0200
                Re: Prob with IE8 and getElementsByName() Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-14 10:17 +0200
    Re: Prob with IE8 and getElementsByName() "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-06-13 08:24 +0300
  Re: Prob with IE8 and getElementsByName() Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-06-12 19:01 +0100

csiph-web