473,394 Members | 1,865 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,394 software developers and data experts.

Get 2nd cell value from table row?

I want to be able to read the value from the 2nd cell in a table row which
contains 5 cells.

The row ID is 'tr2' & I can get the row object using -

var x = document.getElementById('tr2');

How do I get hold of an individual cell's value?

Any links to good web sites showing how to traverse DOM objects?

thanks

harry

Jul 23 '05 #1
2 23568
harry wrote:
I want to be able to read the value from the 2nd cell in a table row which
contains 5 cells.

The row ID is 'tr2' & I can get the row object using -

var x = document.getElementById('tr2');


Try this:

var text = x.cells[1].innerHTML;
Gaetano

Jul 23 '05 #2
harry wrote:
I want to be able to read the value from the 2nd cell in a table row which
contains 5 cells.

The row ID is 'tr2' & I can get the row object using -

var x = document.getElementById('tr2');

How do I get hold of an individual cell's value?
var x = document.getElementById('tr2')
var y= x.getElementsByTagName("TD")
var z=y.item(1).firstChild.data;

Mick

Any links to good web sites showing how to traverse DOM objects?

thanks

harry

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: yukatan | last post by:
let's say this is a html table, how can i get the string value contained in the X cell ? --------------------- | | | | --------------------- | | | ...
8
by: Ben | last post by:
Hi all, Just wondering how to write (using document.write) to a table cell. I have table with 3 rows and 3 colums. I want to write from within the Javascript to say third column of a first row....
11
by: VK | last post by:
Hi, I'm playing around with tables (TOM vs. DOM etc.) I cannot figure out an effective highlight mechanics for the cells: 1) No problems with: <td ...onMouseOver/Out background change> some...
1
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say...
2
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
17
by: toffee | last post by:
Hi all, I have a table with 12 cols and 10 rows. When a user clicks on a table cell; the page is refreshed and displays some data below the table dependant on whichever cell was selected. I...
2
by: cogitoergosum | last post by:
Hi, I have a table with four columns. By default, except for the second column (id="s01") all column values are protected. When a value is selected from second column, the third column is...
7
blazedaces
by: blazedaces | last post by:
Hi guys, what I'm I have is a jtable with boolean variables in the first column and text in the next two (checkboxes). I want my tableChanged method to make it so when I check one of the checkboxes...
0
by: xprimus | last post by:
Can anyone help me with this, I have a linked image in a tale cell and whenever I click on the image it expands, not only that I have to click on it again to get the link to go. These are the...
1
by: swetha123 | last post by:
hello , I need to alert the value entered in the text box,which is in TD cell, using DOM can any one tell how please here is the code with out a text box which is working <html> <head> ...
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:
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.