日期:2014-05-16  浏览次数:20360 次

js控制列表显示列
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script>
  function show(obj) {
var rowCount=document.getElementById(obj).rows
for(i=0;i<rowCount.length;i++){
  var cellCount=rowCount[i].childNodes
  for(j=0;j<cellCount.length;j++){
if(document.getElementById("showButton").checked){
  cellCount[j].style.display="none"
  if(j==0 || j==1 || j==cellCount.length-1)cellCount[j].style.display=""; }
else{
  cellCount[j].style.display="";
}
  }
}
  }
</script>
</HEAD>

<BODY>
<input type="checkbox" id="showButton" onclick="show('tab1');" value="1" />&nbsp;显示
<table id="tab1" name="tabName" border="1">
  <tr>
<td>序号</td>
<td>名称</td>
<td>Money_1</td>
<td>Money_2</td>
<td>Money_3</td>
  </tr>
  <tr>
<td>1</td>
<td>王一</td>
<td>10</td>
<td>20</td>
<td>30</td>
  </tr>
  <tr>
<td>2</td>
<td>王二</td>
<td>40</td>
<td>50</td>
<td>60</td>
  </tr>
    <tr>
<td>3</td>
<td>王三</td>
<td>10</td>
<td>20</td>
<td>30</td>
  </tr>
  <tr>
<td>4</td>
<td>王四</td>
<td>40</td>
<td>50</td>
<td>60</td>
  </tr>
</table>
</BODY>
</HTML>