javascript - 使用javascript使面板可见

标签 javascript asp.net panel

我有一个面板,其属性 Visible 设置为 False

<asp:Panel ID="pnlUpload" runat="server" Visible="False" />

我尝试使用 javascript 作为下面的代码使其可见

document.getElementById('<%= Panel1.ClientID %>').style.visibility = 'visible';

但是它不起作用,伙计们有什么想法吗?

最佳答案

设置 Visible="false"使面板不呈现在生成的 HTML 中。如果你想让它在客户端显示/隐藏,你需要让它 Visible="true"并使用 CSS class/in the style attribute having "display"property with the value "block"or "none"as需要。

关于javascript - 使用javascript使面板可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3930067/

相关文章:

.net - 使用 .NET 的应用程序

JavaScript 错误 : Unable to get property 'style' of undefined or null reference?

c# - 如何根据 ASP.NET MVC 中的 Controller 操作在页面 javascript 中设置变量?

javascript - body onload 是否发生在 window.onload 之前?

javascript - @符号打破 Angular 表达

.net - Html.Action() 导致 StackOverflowException

python - 在 wx.Panel 中点击事件?

javascript - Bootstrap 嵌套可折叠面板

python - 带有 MultiIndex Pandas 面板的切片函数

javascript - 在 VS Code 中使用 Code Runner 运行 JavaScript 时出现“无法识别 "' 节点”错误