使用javascript在按钮单击上隐藏asp.net面板
我试图在单击按钮时隐藏asp.net面板 我使用的JavaScript和控件使用javascript在按钮单击上隐藏asp.net面板,javascript,asp.net,Javascript,Asp.net,我试图在单击按钮时隐藏asp.net面板 我使用的JavaScript和控件 <script type="text/javascript"> function ShowPanel () { document.getElementById("<%= pnlCombinedPdf.ClientID %>").style.display = "none"; } </script> <asp:Button ID="Bu
<script type="text/javascript">
function ShowPanel ()
{
document.getElementById("<%= pnlCombinedPdf.ClientID %>").style.display = "none";
}
</script>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="ShowPanel()"/>
<asp:Panel ID="pnlCombinedPdf" runat="server" Visible="false">
<fieldset>
<legend class="SubSectionHeading">Merge PDF</legend>
<table style="width: 100%">
<tr>
<td>
<asp:Button ID="btnMergePdf" runat="server" Text="Merge PDF"/>
</td>
</tr>
</table>
</fieldset>
</asp:Panel>
功能显示面板()
{
document.getElementById(“”.style.display=“无”;
}
合并PDF
但问题是,单击按钮后,它不会显示面板。请帮助我使其在单击时可见。使用display=“block”
显示,使用display=“none”
隐藏
function ShowPanel ()
{
document.getElementById("<%= pnlCombinedPdf.ClientID %>")
.style.display = "block";
}
功能显示面板()
{
document.getElementById(“”)
.style.display=“块”;
}
您只需更改jquery代码:
function ShowPanel ()
{
document.getElementById("pnlCombinedPdf").style.display = 'none';
return false;
}
仅此而已“我试图在单击按钮时隐藏asp.net面板…问题是它在单击按钮后不会显示面板”-这是因为在单击按钮时隐藏了它。如果是某种切换行为,只需将display
属性从none
切换到block
。