我有一个 C# .NET 页面,我想在按下按钮时使行折叠。我发现了很多类似这样的教程(http://codingforums.com/archive/index.php?t-90375.html),试图实现他们的解决方案,但是当我点击我的按钮时,它们都没有为我做任何事情。为了确保我不会发疯,我制作了一个小测试页来看看这个想法是否有效。出于某种原因,它不是。浏览器是IE6。我正在运行 Visual Studio 2005。有谁知道为什么这不起作用?正如我所期望的那样,呈现的页面显示了一个按钮和一行文本;单击按钮时,文本行不会消失。我知道我可以使用 div,但请记住,这只是一个概念证明;在我的实际应用程序中,必须折叠的是表格行。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Project.Web.Auth.Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Shop Financials</title>
<link href="../StyleSheets/ClaimsV2.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function btnClick(control)
{
try
{
var id_table = document.getElementById(control).style;
if(id_table.display == "block")
{
id_table.display = "none";
}
else
{
id_table.display = "block";
}
}
catch(e)
{
alert(e);
}
}
function toDepositPrinterFriendly()
{
}
</script>
</head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td><asp:Button runat="server" OnClientClick="javascript:btnClick('HeaderRow')"/></td>
</tr>
<tr id="HeaderRow" runat="server">
<td>TEST2</td>
</tr>
</table>
</form>
</body>
</html>