Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Mel Smith" Newsgroups: comp.lang.javascript Subject: Re: Prob with IE8 and getElementsByName() Date: Thu, 13 Jun 2013 08:41:19 -0600 Lines: 53 Message-ID: References: <51b86558$0$6630$9b4e6d93@newsspool2.arcor-online.net> X-Trace: individual.net 6PKiUIsfAWH4la/AWHMRGwJdQnV9aqoHgneZhaHW3lfJwe/ft5 Cancel-Lock: sha1:lnIBWYKFWZ7KZJQfzSIn+Y9ABxk= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Original Xref: csiph.com comp.lang.javascript:20273 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 section, then I'll add the 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