Sagewire Logo

Looping through HTML Table

4 Message(s) by 3 Author(s) originally posted in javascript


From: aroraamit81 Date:   Wednesday, June 20, 2007
Hi,

How to loop through HTML Table in JAVAscript, I want to check if any
of check box in my HTML Table is checked or not.

Thnx in advance

Amit


From: kaaposc Date:   Wednesday, June 20, 2007
wrote in message:
wrote in message:
Hi,

How to loop through HTML Table in JAVAscript, I want to check if any
of check box in my HTML Table is checked or not.
depends on structure of your table .
in general way it should be something like:
// first we get all row s
var rows = new Array();
rows = document.getElementById("tableId").getElementsByTagName("TR");
// next we can loop through this array and get all cells
for(var I = 0; i < rows.length; i++) {
var cells = new Array();
cells = rows[i].getElementsByTagName("TD");
}
so you can loop through cells for each row to check if there is <input
type ="checkbox" />
and if it is checked.



ok, similar way to get all checkboxes is:

document.getElementById("tableId").getElementsByTagName("INPUT");

then loop through all input to check 1)if it's type is checkbox and 2)if
it is checked.

--
-- kaaposc
"The Knowledge is Power"


From: aroraamit81 Date:   Thursday, June 21, 2007
Thnx Mate!

Regards

Amit


From: intrader Date:   Sunday, September 09, 2007
wrote in message:
Hi,
How to loop through HTML Table in JAVAscript, I want to check if any
of check box in my HTML Table is checked or not.
Thnx in advance
Amit


You have a feasible answer.
Consider naming your checkboxes with the same id. Then you can say

var checkboxesArray = document.getElementById("checkboxId")

and then loop through the array of checkboxes.



Next Message: Adding Date/Time to an HTML form? - Request_Information_b.html (0/1)


Blogs related to Looping through HTML Table

JAV Ascript String Concatenation
The improved version of HTML table generator is presented on Listing 3. The changes are very small. Instead of using one buffer buf for all string concatenations, we use additional intermediate buffer row in the inner loop. ...

RE: Flash Plugin (created)
The macro passes through parameters it does not understand like the optional flash parameters. So just try it. View the HTML source after and make sure its what you expect. Posted by: Bob Swift at Apr 12, 2007 06:05. in reply to: ...

Java 6 Feature : Working with Derby Database
The Java 5 and Java 6 releases have introduced some significant changes. While Java 5 introduces new features (eg Generics, Variable arguments, Enhanced for loop, Boxing/unboxing, Type-safe enumerations, Static import, Metadata), Java 6 ...

Sortable.create updated by Ben Bodien
childNodes; // get nodes x = 0; while(x < CN.length){ // loop through elements for the desired one if(CN[x].id == li_id){ new_obj = CN[x].cloneNode(true); //create copy of node break; // End the loop since we found the element }else{ ...

Flash Plugin (updated)
Transparent the background of the HTML page shows through all transparent portions of the movie, this may slow animation performance. BGCOLOR - (#RRGGBB, hexadecimal RGB value) Specifies the background color of the movie. ...

First thoughts about Python vs. PL/SQL
Right now, you can query all the countries into one array and all the capitals into another, but then you have to loop through them all and construct a new hash table from the 2 arrays. Seems like a logical shortcut to allow queries to ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional