473,503 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

get value of TD

How can i get value of a td in a table?
I tried
tabl=document.getElementById("table").rows[0].innerText;

but this is only supported by iexplorer.

Feb 20 '06 #1
4 13360
polilop said the following on 2/20/2006 12:11 PM:
How can i get value of a td in a table?
I tried
tabl=document.getElementById("table").rows[0].innerText;

but this is only supported by iexplorer.


..nodeValue
..innerHTML

Among others.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 20 '06 #2
.node Value not Supported by Mozilla
.innerHTML works fine

Thx
"Randy Webb" <Hi************@aol.com> wrote in message
news:1b********************@comcast.com...
polilop said the following on 2/20/2006 12:11 PM:
How can i get value of a td in a table?
I tried
tabl=document.getElementById("table").rows[0].innerText;

but this is only supported by iexplorer.


.nodeValue
.innerHTML

Among others.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/

Feb 20 '06 #3


polilop wrote:
.node Value not Supported by Mozilla "Randy Webb" <Hi************@aol.com> wrote

.nodeValue


Randy said nodeValue not node Value. nodeValue is supported by Mozilla
as it is specified in the W3C DOM Core for any node. However for element
nodes nodeValue is by definition null which is not what you are looking
for if you use innerText in the IE DOM.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 20 '06 #4
polilop wrote:
How can i get value of a td in a table?
I tried
tabl=document.getElementById("table").rows[0].innerText;

but this is only supported by iexplorer.


I guess you are after the text in the node with any HTML tags stripped
out. The following function uses W3C DOM 3 textContent or innerText or
recurses through the child nodes grabbing the text.

You may want to modify it to deal with other node types.
function getElText(el)
{
if (el.textContent) return el.textContent;
if (el.innerText) return el.innerText;
var x = el.childNodes;
var txt = '';
for (var i=0, len=x.length; i<len; ++i){
if (3 == x[i].nodeType) {
txt += x[i].data;
} else if (1 == x[i].nodeType){
txt += getElText(x[i]);
}
}
return txt.replace(/\s+/g,' ');
}

--
Rob
Feb 20 '06 #5

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

Similar topics

1
14124
by: G Kannan | last post by:
Hey all! I have written a perl script to retrieve information from a HTML Form and insert the data into an Oracle database table. I am gettting the the following error message: "Use of...
3
18176
by: otto | last post by:
i need to read a variable in a javascript and translate it to a form in html the javascript variable is: <SCRIPT LANGUAGE='JavaScript'>RF2N('Total');</script> and i need to put that...
3
11913
by: Eric Chang | last post by:
I was working on this simple form with radio boxes. And when I click on one of the radio box, it tell me the value is "undefined" Why is that ? I did defined the value of each radio box: ...
16
11462
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
4
3003
by: dmiller23462 | last post by:
So here's my problem.....I need to set up different email distributions based on which option in the following Select form has been chosen....For instance if "Putaway" is chosen it needs to email...
7
5065
by: matthew_carver | last post by:
Hello, I have an ASP page that loops through a SQL Server 2000 table, then downloads an Excel sheet the users can save, etc. Works fine, except, I see that in one particular "comments" field the...
13
10086
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
0
4078
by: tania | last post by:
i have this table in my database: CREATE TABLE FILM( F_ID INT(5) NOT NULL AUTO_INCREMENT, F_TITLE VARCHAR(40) NOT NULL, DIRECTOR_FNAME VARCHAR(20) NOT NULL, DIRECTOR_LNAME VARCHAR(20) NOT NULL,...
1
2298
by: cbellew | last post by:
Hi guys, I have a problem with an option group and a two corresponding text boxes. When the user chooses an option value i want the text boxes to populate with text dependent on the choice made....
275
12035
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
7086
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
7460
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...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.