<html>
<script language="
javascript>
function clik(){
var div_data=document.getElementById("div_ta").getElementsByTagName("div");
alert('111='+div_data.length);
for(var i=0;i<div_data.length;i++)
{
if(div_data[i].style.display=="none")
{
div_data[i].style.display="block"; //div显示与隐藏
} else {
div_data[i].style.display="none";
}
} //by www.jb200.com
}
</script>
<body>
<input type="button" onClick="clik()" value="div显示与隐藏"/>
<table width="223" height="123" border="1" id="div_ta">
<tr>
<td><div id="div1" style="display:none;">div1</div></td>
<td><div id="div2" style="display:block;">div2</div></td>
</tr>
<tr>
<td><div id="div4" style="display:none;">div4</div></td>
<td><div id="div5" style="display:block;">div5</div></td>
</tr>
<tr>
<td><div id="div7" style="display:none;">div7</div></td>
<td><div id="div8" style="display:block;">div8</div></td>
</tr>
</table>
</body>
</html>