IE和 firefox 关于 table 行隐藏和显示 错乱怎么解决
sblig
2010-10-14
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> 显示隐藏列 </TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function setHiddenCol(oTable,iCol)//Writed by QQ:190988779 at 2007-7-24 11:14:09 { for (i=0;i < oTable.rows.length ; i++) { oTable.rows[i].cells[iCol].style.display = oTable.rows[i].cells[iCol].style.display=="none"?"block":"none"; } } function setHiddenRow(oTable,iRow)//Writed by QQ:190988779 at 2007-7-24 11:14:09 { oTable.rows[iRow].style.display = oTable.rows[iRow].style.display == "none"?"block":"none"; } //--> </SCRIPT> </HEAD> <BODY> <TABLE id="Table1" cellSpacing="1" cellPadding="1" border="1"> <TR> <TD width="20%">00</TD> <TD width="20%" bgcolor="#E3E3E3">01</TD> <TD width="20%">02</TD></TR> <TR> <TD width="20%" bgcolor="red">10</TD> <TD width="20%" bgcolor="green">11</TD> <TD width="20%" bgcolor="red">12</TD></TR> <TR> <TD width="20%">20</TD> <TD width="20%" bgcolor="#E3E3E3">21</TD> <TD width="20%">22</TD></TR> </TABLE> </P> <INPUT id="btnHiddenCol" type="button" value="显示/隐藏第2列" name="btnHiddenCol" onclick="setHiddenCol(document.getElementById('Table1'),1)"> <INPUT id="btnHiddenRow" type="button" value="显示/隐藏第2行" name="btnHiddenRow" onclick="setHiddenRow(document.getElementById('Table1'),1)"> </BODY> </HTML>
|
|
s220700113
2011-09-27
错乱是什么意思 ,如果是表格格式变得不对,那你试试将"block"改成"",
就是要显示的时候display="",要隐藏的时候display="none"; display没值的话代码怎么写就怎么排版。 |
|
稀巴烂
2011-10-16
贴出的代码可读性太差。
|