Javascript traversal Html Table example (including content and attribute values), javascripttable
1: traverse and output the Table Median
<table id="tb"><tr><td></td></tr><tr><td></td></tr></table>function f(){var t=document.getElementById("tb").childNodes.item(0);for(var i=0;i< t.childNodes.length;i++){for(var j=0;j<t.childNodes(i).childNodes.length;j++){alert(t.childNodes(i).childNodes(j).innerText);}}}
2: traverse the Table and read the CheckBox status and other Column values.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Javascript traverses the data in the table, complex nesting
Hello, it's easy to use jQuery to solve your problem.
// Traverse each table $ ("table "). each (function (I) {// obtain the first row of the table var $ tr = $ (this ). find ("tr "). first (); // obtain the first td column var $ secondTd = $ tr. find ("td "). eq (1); // obtain the target value var val = $ second. val (); // determine whether the target value is equal to the input value. The input value is expressed as if (val = Hangzhou) {// if it is equal, returns the value of the first column: return $ seconTd. prev ("td "). val ();}});
JavaScript traversal of Object Attributes
C: "kankan3 ",}
In IE, there cannot be a semicolon. Your program has an error here, So IE cannot run.