用js遍历 table

| |
[不指定 2008/07/04 15:34 | by Else ]

var tableObj = document.getElementById("tableName");
var str = "";
for(var i=0;i<tableObj.rows.length;i++)
{
   for(varj=0;j<tableObj.rows[i].cells.length;j++)
   {
      //str += tableObj.rows[i].cells[j].innerHTML+"   ";

           for(var z=0;z<tableObj.rows[i].cells[j].children.length;z++)
           {
        var text = tableObj.rows[i].cells[j].children[z];//取得text object
                str += text.value;
           }
   }
   str+="\n";
}
alert(str);


用js遍历 table

作者:Else 's Blog
地址:http://www.aixq.com/post/1100/
版权所有。转载时必须链接形式注明作者和原始出处及本声明!
  • 中查看更多“用js遍历 table”相关内容
  • 中查看更多“用js遍历 table”相关内容
  • 中查看更多“用js遍历 table”相关内容
  • 中查看更多“用js遍历 table”相关内容
  • 中查看更多“用js遍历 table”相关内容
  • 中查看更多“用js遍历 table”相关内容
  • Tags: ,
    直播 在线 电视 | 评论(1) | 引用(0) | 阅读(730)
    皮雷
    2008/07/07 18:05
    貌似《javascript高级设计》上的遍历器没有用。
    分页: 1/1 第一页 1 最后页
    发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    昵称   密码   游客无需密码
    网址   电邮   [注册]