我希望能用javascript控制Panel的隐藏与显示问题是这样:为什么第一次点击Checkbox1时Panel1就隐藏了,但是不管我再点多少次,Panel都不能在重新现实呢?代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="a.aspx.cs" Inherits="a" %><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function Checkbox1_onclick()
{
if (document.all.Checkbox1.Checked)
{document.all.Panel1.style.display='';}
else
{document.all.Panel1.style.display='none';}
}
</script>
</head>
<body>
<input id="Checkbox1" type="checkbox" onclick="return Checkbox1_onclick()" /><br />
<asp:Panel ID="Panel1" runat="server" Height="269px" Width="553px">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></asp:Panel>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="a.aspx.cs" Inherits="a" %><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function Checkbox1_onclick()
{
if (document.all.Checkbox1.Checked)
{document.all.Panel1.style.display='';}
else
{document.all.Panel1.style.display='none';}
}
</script>
</head>
<body>
<input id="Checkbox1" type="checkbox" onclick="return Checkbox1_onclick()" /><br />
<asp:Panel ID="Panel1" runat="server" Height="269px" Width="553px">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></asp:Panel>
</body>
</html>
if (document.all.Checkbox1.Checked)=>>if (document.all.Checkbox1.checked)
http://topic.csdn.net/t/20030122/20/1384486.html