473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Locating a TD inside of a TR.

This is really simple, I almost feel bad for posting it.

Expand|Select|Wrap|Line Numbers
  1. var theTable = document.getElementById("hdpart-" + (x+1));
  2.         var theTableCell = theTable.tBodies[0].getElementsByTagName("td");
  3.         var theTableRow = theTable.tBodies[0].getElementsByTagName("tr");
instead of theTableCell pointing to every <td> tag in the table, I need it to only return the <td> inside of the <tr>. I was thinking something like

Expand|Select|Wrap|Line Numbers
  1. var theTableCell = theTableRow.getElementsByTagName("td");
but that didn't work. Does anyone know what this would be? Thanks.
Oct 5 '07 #1
4 1805
pbmods
5,821 Expert 4TB
Heya, sdustinh.

Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).

How about this:
Expand|Select|Wrap|Line Numbers
  1. var theTableCell = theTableRow.getElementsByTagName("td")[0];
  2.  
Note the 's' in getElementsByTagName().
Oct 6 '07 #2
Sorry, I was in a hurry and just didn't think about the title.

I tried changing it over to that, but I still get an "Value undefined (result of expression theTableRow.getElementsByTagName) is not an object" error.

Expand|Select|Wrap|Line Numbers
  1. var theTable = document.getElementById("hdpart-" + (x+1));
  2.         var theTableRow = theTable.tBodies[0].getElementsByTagName("tr");
  3.         var theTableCell = theTableRow.getElementsByTagName("td")[0];
What I'm doing is searching a specific table, then pulling all of the rows from that table, and within those rows, I need to pull the cell information from the specific rows. I've got everything set up, but right now using "theTable.tBodies[0].getElementsByTagName("td")" it searches through all the tables TD elements.

So if there are 2 rows with 9 cells in each table, and I use theTableCell.length I get 54 returned rather than the 18 I was expecting. I just can't figure out how to point it to that specific row.

Thanks for the help!
Oct 8 '07 #3
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. var theTableRow = theTable.tBodies[0].getElementsByTagName("tr")[need something here];
Oct 8 '07 #4
Awesome, that got it! I had to rearrange somet things and it's not as pretty as I'd hoped... but it works now, so that's all that matters. Thanks a lot!
Oct 8 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jonathan Gennick | last post by:
Alex Martelli, Anna Ravenscroft, and I are trying to locate the following people, whose Actionstate Python Cookbook recipes we are wishing to use in the second, printed edition of the Python...
5
by: effendi | last post by:
What is the most efficient method I could use to locate if a string is already in my list? I need to verify if a name submitted by a user has been submitted before and potentially my list can ve...
4
by: Adie | last post by:
Is it just me, or does the MSDN documentation lack details of the namespace any given class is contained in? Also, why is there no way of searching the object browser? Or again, is it just me...
0
by: Anne | last post by:
hie there, i have a couple of questions that i need help on. the first is regarding the closing of a browser.i have an exit button which on click i would like it to totally close the browser, and...
0
by: Johann Blake | last post by:
I'm having trouble grasping how ASP.NET correctly locates resources. There is plenty of documentation on this subject but some things are not clear at all. In my ASP.NET application, I have...
6
by: Dugan Zhang | last post by:
Previously I was building websites using asp. I have a folder name "projects", under the projects folder, I have number of subfolders, each subfolder represent a website I'm building. Inside each...
1
by: Friskusen | last post by:
I have been working on a control for a while now. One of the properties belonging to this control is rather complicated , so i have written a custom property editor for it. Whenever i click this...
3
by: TB | last post by:
Hi All: How do I find all textboxes on a page and change a certain property ('enabled' for example) on each of them? I thought of doing something like this: sub changemytexboxes() Dim mytxb...
4
by: Ty | last post by:
Hi all Short version of my problem: i have a Datagrid (Flexgrid from ComponentOne) with a Datatable as source. I need to search a row in the datatable, using a primary key column in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.