hey buddy i read this code of urs on one of the threads my concern is tht i need to to atore the data form each row in the table into an array..... or a srting.....
could u please help me with this???


<script type="text/javascript">
#
function showContent() {
#

#
var oTBL = document.getElementById('myTable')
#
for (var x = 0; x < oTBL.rows.length; x++) {
#
for (var y = 0; y < oTBL.rows[x].cells.length; y++) {
#
alert(oTBL.rows[x].cells[y].firstChild.data);
#
}
#
}
#
}

Recommended Answers

Search for javascript push() method in the Array object.

A good reference is here: http://www.w3schools.com/jsref/jsref_obj_array.asp

HTH

Jump to Post

All 2 Replies

hey buddy i read this code of urs on one of the threads my concern is tht i need to to atore the data form each row in the table into an array..... or a srting.....
could u please help me with this???


<script type="text/javascript">
#
function showContent() {
#

#
var oTBL = document.getElementById('myTable')
#
for (var x = 0; x < oTBL.rows.length; x++) {
#
for (var y = 0; y < oTBL.rows[x].cells.length; y++) {
#
alert(oTBL.rows[x].cells[y].firstChild.data);
#
}
#
}
#
}

Paste the HTML to your table and we'll be able to better help. Do you want to do it for all the tables on the page, even if the table is used for formatting? Or is it a particular table on the page that has a set id?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.