table表格——一行隐藏和显示

  • Post author:
  • Post category:其他


<html>

<head>

<script language=”javascript” type=”text/javascript”>

function setDetailMsgRow(rowID, btn) {

var row = document.getElementById(rowID);

if (row != null) {

if (row.style.display == (document.all ? “block” : “table-row”)) {

row.style.display = “none”;

}

else {

row.style.display = (document.all ? “block” : “table-row”);

}

}

if (btn != null) {

if (btn.value != “Hide Message”)

btn.value = “Hide Message”;

else

btn.value = “Show Message”;

}

}

</script>

</head>

<body>

<form id=”form1″ runat=”server”>

<div>

<input type=”button” οnclick=”setDetailMsgRow(‘tmpRow0’,this)” value=”Show Message”/>

<table border=”1″><tr id=”tmpRow0″

style=”display:none;color:Blue”><td>aa</td><td>44aa</td></tr>

<tr id=”tmpRow1″><td>bb</td><td>44bb</td></tr>

<tr id=”tmpRow2″><td>cc</td><td>44cc</td></tr>

<tr id=”tmpRow3″><td>dd</td><td>44dd</td></tr>

<tr id=”tmpRow4″><td>ee</td><td>44ee</td></tr>

</table>

</div>

</form>

</body>

</html>