0

What I need to do is load only the second table (Or tbody) element (Un-named and has no class), from the div named megaContent. What I'm planning to do is have the browser go to the page, then load this JS and have it display that part only.

4

1 回答 1

1

目前尚不清楚“仅加载表格”是什么意思。如果您只想显示表并且由于它没有任何类或 id 而不知道如何访问它,您可以执行以下操作:

var tbls = document.getElementById("megaContent").getElementsByTagName("table");
var tbl = tbls[0]; // [0] if the desired table is the first table in that div, [1] if second etc.
tbl.style.display="block"; //or "table", or whatever you'd like to do with that table.

希望这可以帮助。

于 2013-10-07T03:36:38.810 回答