2011-11-24 53 views

回答

0

我不会包含这样一个简单的任务jQuery。

var table = document.getElememtsByTagName("table")[0]; //if it is the first or only table, you could change 0 to any other number if the table always is at the same position 

,或者你可以给你的表中的ID:

var table = document.getElementById("my-table"); 

获得HTML就叫

var foo = table.innerHtml; 
+0

谢谢! getElementsByTagName(not getElememtsByTagName) – user1062554

1

最简单的方法是使用jQuery来选择表格并返回HTML。例如$('table').html()将返回一个<table>标记的字符串。

+0

我怎样才能得到正是我想要的表(有很多表上这一页)? 你能提供代码的例子吗? – user1062554

+0

用我的示例中的'table'替换为特定于表的'#id'。 – abraham

+0

正如您所看到的,此表中没有ID,并且我无法为该表提供ID(如果我可以这样做,为什么需要Chrome扩展?)。 – user1062554

相关问题