Hey, I'm not as familiar with JavaScript as I'd like to be so I need a little bit of help with a problem I've got. I've got a table that I need to cycle through and gather what is on the inside of each cell, and store them into something like an array.
The table has an undetermined amount of rows (they can be created by the user) but it has 8 cells within each row I need to get the contents out of. I'd like to put it all into an array, something like this: - var aVariable = new Array();
-
aVariable[0] = "/boot|ext3|1234|no|no|-|-|-";
Then I need to take each string in the array and break it apart. I don't really need help with this, I've got that figured out, but I just can't figure out how to cycle through the table rows and cells to put the information into the array. So far I've come up with something like this: - for (var x = 1; x < totalHD; x++) {
-
var theTableID = document.getElementById("hdpart-" + x);
-
var theTableRow = theTableID.tBodies[0].getElementsByTagName("tr");
-
var theTableCell = theTableID.tBodies[0].theTableRow.getElementsByTagName("td");
-
-
-
-
}
totalHD is the number of tables, then within those tables it needs to go through each row and collect the information from each cell. If anyone has any suggestions, I'd really appreciate any help. Thanks!
3 1605 gits 5,390
Recognized Expert Moderator Expert
hi ...
getElementsByTa gName returns a node list so you have to loop through the table rows and retrieve the table-cells for every row. now loop through the cells and retrieve the needed values ... you may push them into arrays or use an object as a table-values list. when you have parsed all tables you may calculate with the retrieved values or whatever ... you may do the calculation even during parsing ...
kind regards
Got it! Pretty simple, I just make it a lot harder for some reason. Thanks!
gits 5,390
Recognized Expert Moderator Expert
hi ...
glad to hear you got it working ... post back to the forum anytime you have more questions ...
kind regards
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sugapablo |
last post by:
Can anyone help me out with some code to change three table cells
(<td>) when one is hovered over?
I have a calendar grid where each day is made up of three table cells and
I want all three to change color when any of the three are hovered over.
I would prefer to do this with pure CSS if possible, but if Javascript is
the only way...so be it.
--
|
by: jeffsal |
last post by:
I am using sorttable.js to sort a table which works fine which allows a
user to sort the table by clicking on the column header. Is there some
code I could add to the page (onload or something) to auto sort by the
first column without user clicking on it. Here is the sorttable.js
code.
addEvent(window, "load", sortables_init);
var SORT_COLUMN_INDEX;
|
by: cotton_gear |
last post by:
Hello,
Fiest of all let me thank this group for so quick in responding to any
postings.
I am using a javascript based utility from a site to sort the columns
of the table. But, for some strange reason it is not working on colmuns
containg checkboxes, text-boxes (or, any user input fileds). For
checkbox column, the values are lost when clicked on the column title
to sort.
I tried a lot to modify but couldnt achive what I wanted.
|
by: -:= Cactus |
last post by:
Hi!
I've made a form for dataentry in a simple table. However when there
are records in that table and I open the form it only displays the new
(blank) record. The total number of records is 1, despite more records
already being entered in the table.
If I add a new record it is saved in the table and the total count of
records is indeed increased by one. I can than scroll to the two
records but it is not possible to scroll through the...
|
by: Shawn B. |
last post by:
Greetings,
I am trying to create a table that has a scrolling body. The problem I'm
experiencing is that if the columns in the "body" part of the table exceed
the width of the "header" then they columns lose their alignment. Can
anyone help me correct this?
| |
by: Kamal |
last post by:
Hello all,
I have a very simple html table with collapsible rows and sorting
capabilities. The collapsible row is hidden with css rule
(display:none). When one clicks in the left of the expandable row, the
hidden row is made visible with css. The problem is when i sort the
rows, the hidden rows get sorted as well which i don't want and want
to be moved (while sorting) relative to their parent rows. The
following is my complete html code...
|
by: Romulo NF |
last post by:
Greetings again to everyone,
Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data, call determined functions, and edit the data already present
What will you need to use the grid? A table with standard markup and an ID to call the script that will turn the table into a grid
Parameters:
tabelaID => id of the table that will...
|
by: Romulo NF |
last post by:
Greetings,
I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented.
I´ve also commented the whole code so you guys can easier understand it engine.
What exactly we need when trying to make a column drag &...
|
by: jrod11 |
last post by:
hi,
I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums there are, it crashes.
There are currently 6 columns, and I only want 4. How do I remove the last two (discount and date)?
Here is a link: http://www.jaredmoore.com/tablesorter/docs/salestable.html
Here is some jquery js that I think...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |